• 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
17
Question by nschrag · Mar 09, 2012 at 07:43 AM · editorprefabhideflags

Is there a HideFlags.DontSave equivalent for preventing child objects from being applied to a prefab?

I have a prefab that adds GameObjects as children of itself on Start(). I want this to occur in the editor (using ExecuteInEditMode) so that I can preview the scene without actually playing the game. By using HideFlags.DontSave on the generated GameObjects, I can keep them from being saved to the scene. However, the flags appear to have no affect on Apply to Prefab. When I Apply, the GameObjects get added to the prefab. Is there any way to prevent this?

Comment
Add comment · Show 11
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 BigDawgKS · Aug 17, 2013 at 05:10 PM 0
Share

I would also like to know if this is possible. I wish to achieve essentially the same thing. I have tried also setting HideInHierarchy/HideAndDontSave HideFlags but these don't appear to prevent saving the objects to the prefab.

avatar image Brackman · Jan 27, 2014 at 10:07 PM 0
Share

I would also like to know this...

avatar image vexe · Feb 19, 2014 at 01:21 PM 0
Share

yea me too

avatar image iwHiteRabbiT · Feb 26, 2015 at 08:05 PM 0
Share

Up please, this issue is really a problem, is it concidered as a known bug ?

avatar image frarees · Mar 21, 2015 at 09:34 AM 1
Share

AFAI$$anonymous$$ GameObject Inspector's Apply button does a ReplacePrefab with the ConnectToPrefab option. ReplacePrefab is defined in unmanaged land (i.e. C++ side), so there's no chance we can see how this works internally... but it seems to me it collects the hierarchy without taking into account each object hide flags. So... I'm afraid there is no way (as of Unity 5.0.0f4) to prevent children being applied to prefab via hide flags.

This seems an consistency issue I$$anonymous$$O. $$anonymous$$aybe it's a good idea to report/discuss it with the $$anonymous$$m itself? If there's a reason this should be working the way it is, I'd like to know..

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

16 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 avatar image avatar image avatar image

Related Questions

Instantiating a prefab in the editor is orphaning the children of the prefabs 0 Answers

Why does my prefab create a child by itself in ProjectView 0 Answers

Why my prefab is auto changing? 3 Answers

Mark gameobject field as changed from prefab 2 Answers

changing a bool in a prefab doesn't change in it's instance. 2 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