Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
2
Question by yoyo · Mar 19, 2011 at 12:19 AM · editorprefabsceneversion-controlworkflow

Can I change a prefab without changing the scene?

When I modify and save a prefab the .unity scene file also changes. Why?

In a team environment we need multiple people to be able to make changes to prefabs without having to modify the scene itself. Is this possible?

For example -- after changing a single numeric property of a prefab, six instances of which are in my scene, I looked at the modified scene file with a hex editor. It appears that Unity saves all the properties for each instance of a prefab, even if the property has not been modified from the original prefab value -- I found six numeric changes matching my edit. In addition, there are lots of other unidentifiable changes in the scene file, in what look like 16-byte GUIDs, perhaps asset references?

This begs the question of what happens if my prefab is instanced in more than one scene? Since only one scene is open in the editor, these other scenes won't be changed until later when they are loaded. Which makes it seem that the changes in the scene aren't necessary -- in fact I reverted the scene file in version control and it still loaded fine and got the new prefab settings. So if it doesn't need to be changed then why change it? Is it safe to ignore these changes?

Any advice on team-based prefab workflow is appreciated. (I've just upgraded to Unity 3.3 Pro, and enabled external version control, but I believe the same issue applies to Unity Free.)

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Wolfram · May 24, 2011 at 09:34 PM

Yes, you can change the prefab in the Project view, without having to save the scene afterwards. We use that all the time, and it is a vital feature when several people are working on the same scene - we split sections of the scene into individual prefabs, which can be worked on and uploaded to the Asset Server individually, without the need for everyone to modify and update the scene as well.

When loading a scene, Unity updates any prefab changes on-the-fly, and integrates information about all(?) of the prefab's settings and parameters into the scene, even if they are unmodified default values. Therefore the scene is shown as modified, although nothing vital actually has changed.

Only if you do any local modifications to the prefab instance in your scene, or if you apply any previous local modifications do you need to save the scene as well.

This should also work if you change a prefab in the Project view that already has local modifications in one or more scenes.

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
1

Answer by Bunny83 · Mar 19, 2011 at 12:55 AM

My guess is since prefabs are an editor only feature in the end all prefab values will end up in the corresponding scenes at building time. There is still the original GameObject in the asset-database that will be used when you invoke Instantiate with a prefab reference but the prefab linkage is no longer available at runtime.

I think the changes won't hurt. As I said i think the changes will be made anyway to all scenes when you build your game. In the scene you always have the option to override any prefab values. These changes will also be saved in the scene.

Comment
Add comment · Show 3 · 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 Joshua · Mar 19, 2011 at 03:14 AM 0
Share

Yeah, I think you do get the option to 'save changes' but that weather you do save or not the data in the scenefile will be identical. The metadata will be different before saving though, but this doesn't matter.

avatar image yoyo · Mar 19, 2011 at 03:53 AM 0
Share

The scene file isn't identical, and it isn't the same size. There are a substantial number of differences in the binary file. Looks like I'll end up implementing an auto-dump to text file at asset save time, so I can see what's changed in prefabs and in the scene. ($$anonymous$$y Unity doesn't natively serialize to a text format.)

avatar image yoyo · Apr 24, 2012 at 04:38 PM 0
Share

Unity 3.5, yaml for scenes and prefabs, thanks UT! :-)

avatar image
0

Answer by gekidoslair · Dec 06, 2013 at 09:17 PM

create an 'inventory' scene of sorts that stores all of the base prefabs, so you can manage / edit / work on the prefabs independently of working on the actual scenes that USE the prefabs.

As well, I'd highly recommend switching / setting all of unity's files to text instead of binary, makes merging any changes infinitely easier.

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 Wolfram · Dec 06, 2013 at 10:23 PM 0
Share

It's not really necessary to create such a scene just to edit your prefabs. Just drag them into an empty scene, edit, and apply. Or, for example if you're currently working on your main scene and have instances of prefabs with (necessary) local modifications in your scene but you just need to modify something in your prefab (that cannot be modified in the Project tab directly since that will only show the top two levels of a prefab's hierarchy), just drag the prefab from the Project tab somewhere into your scene. Then you can modify it, apply, and delete the instance again. Any other instances of that prefab in your scene will update at that point - but keep their local modifications.

Also, I fully agree on the text vs. binary thing. It would be a pain (or simply impossible) to compare and integrate changes of other $$anonymous$$m members without the text mode.

avatar image gekidoslair · Dec 06, 2013 at 10:34 PM 1
Share

For sure, you can do that for one-off changes, but most of the assets that require prefabs in our title can be lumped into individual categories (for example the game 'characters' or 'vehicles' etc) that it does make sense to have an inventory scene of just for easy / quick reference.

Only challenge with merging might be if you have multiple people adding files to the inventory scenes at the same time - but again the text mode meta files actually allow most RCS systems to merge the changes somewhat sanely (and effectively). We haven't run into much problems with Subversion and/or Perforce (the two systems I've used this technique with).

Worst case scenario we've run into, you can save a copy of your local scene and 'copy / paste' any game objects into the main scene after syncing, but I've only needed to do this once or twice that I can recall.

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.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Is it possible to ensure that certain game objects don't get saved in the scene or otherwise hook into the default save scene to run custom editor code? 2 Answers

How to turn off m_Modification for prefabs? 0 Answers

Handling scene objects 1 Answer

Can the "Apply" to prefab button be disabled? 1 Answer

Need of having prefab in Scene 1 Answer


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