• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
4
Question by tomka · Feb 06, 2012 at 11:05 PM · prefab

Changes to prefab parameters not being saved

In Unity 3.5.0b6 I have a script attached to a prefab with some Serialized floats. When I change the floats in the unity editor, they update fine. But any changes I make are not saved to the .prefab file

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gabs · Feb 07, 2012 at 01:53 PM 0
Share

This is annoying. It's happening to me too. I had a script that updated some prefab instances on specific scenes, now I need to go over 80+ scenes manually. It's taking forever. The changes done by script are never saved to the prefab instances, even after you save a scene, it reverts to the prefab default values.

avatar image XtOf · Feb 21, 2012 at 02:22 PM 0
Share

Happen to us too with "uLink Network View" component modified by the assignement wizard. It makes this version of Unity (3.5.0f5) totaly useless :(

avatar image Sat · Mar 12, 2012 at 02:23 PM 0
Share

Any update on this bug? Really annoying one, as it prevent us from upgrading to Unity 3.5!...

5 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by stephanrmiller · Feb 08, 2012 at 07:10 PM

I'm not sure I completely understand your problem, but if it's something like this:

You have a Player prefab with a PlayerStats.cs script attched to it PlayerStats.cs has a maxHealth attribute which was originally 100, but now you edited it so that it's 50 You expect the Player prefab to update maxHealth to 50, but it doesn't :(

Then try commenting out the attribute in the script, going back into the Unity editor (pulls in the script, removes the attribute from the prefab), then go back to the script and un-comment it, then go back into Unity and it should pull in the new script with the new value for the attribute.

Comment
Add comment · Show 5 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gabs · Feb 09, 2012 at 08:56 AM 0
Share

That's not the case. Let me show what happens in Unity 3.5b: 1 - Have a prefab on a scene; 2 - Run a custom wizard script that alters some values on the instantiated prefab (not the prefab itself); 3 - Save the scene; 4 - Hit play. Now the prefab instance values were reverted to the prefab original values and the changes your wizard script made are lost forever :(

SInce this newest Unity version, prefab instances are only saving values that you modify by hand. Wizard scripts became broken.

avatar image stephanrmiller · Feb 09, 2012 at 01:12 PM 0
Share

Hmm, if it worked in the previous version, then it looks like a bug. Has anyone reported it?

avatar image gabs · Feb 09, 2012 at 02:31 PM 0
Share

I'll setup a project to reproduce this, then I'll submit.

avatar image XtOf · Feb 21, 2012 at 02:23 PM 0
Share

Not a valid solution for us anyway because it happens on a "uLink Network View" component that is not editable by script.

avatar image stephanrmiller · Feb 21, 2012 at 02:33 PM 0
Share

Oh, I don't have any experience with uLink...

avatar image
0

Answer by GameGuy · Mar 12, 2012 at 02:44 PM

You can change the floats in your script to the "correct" value, then select the prefab in ProjectView and chose revert to Prefab.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Sat · Mar 12, 2012 at 02:47 PM 0
Share

This does not solve the problem, which is that the changes made by editor scripts on prefabs are not saved.

avatar image GameGuy · Mar 12, 2012 at 02:50 PM 0
Share

Thats true, but a better workaround then running through 80 Scenes by hand, much faster and less prone.

avatar image
0

Answer by smarcus · Apr 01, 2012 at 05:05 PM

I'm seeing something similar when I convert a project from 3.4.2... some of my prefabs are "going stock" and reverting to default settings across the board.,

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Wolfram · Apr 19, 2012 at 06:03 PM 0
Share

If you still have a 3.4 copy of your project, here is a script that fixes this problem: http://forum.unity3d.com/threads/132489-Resetting-PrefabOverride-Flags-for-Instantiated-Prefabs-in-3.4.x?p=897802&viewfull=1#post897802

avatar image
0

Answer by Wolfram · Apr 17, 2012 at 04:25 PM

Maybe this discussion is helping? They suggest calling EditorUtility.SetDirty(arg) when using Editor scripts to modify prefabs/prefab instances: http://unity3d.qatohost.com/questions/62455/how-do-i-make-fields-in-the-inspector-go-bold-when.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by SZApo · Jul 07, 2012 at 12:56 AM

I've found a solution to similar problem: 1) Make some changes in the prefab instance using editor script. 2) Unlink prefab instance: PrefabUtility.DisconnectPrefabInstance(yourInstance); 3) Link it with its prefab again: PrefabUtility.ReconnectToLastPrefab(yourInstance);

After these manipulations it can be saved well and shows in bold in editor, and instances holds all their links.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Script is reading from prefab instead of instance 1 Answer

How to attach a script to a static Tree Prefab? 1 Answer

How do i make a cube "slide"and fixed on a rail? 0 Answers

Player spawn after touching 0 Answers

Perforce Save Project checks out random prefabs 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges