• 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
14
Question by Ted-Brown · Jun 14, 2013 at 07:25 PM · editorprefabchildprefabutility

Safely deleting a child of a prefab

This is with Unity 4.1.3f3

I have a prefab with multiple child objects. One of those objects needs to be deleted. Selecting the child object, right-clicking, and selecting "Delete" does nothing.

I can "re-create" the prefab without this child object by pulling it into the scene, deleting the child object in the scene hierarchy, deleting the prefab in the project view, then re-creating the prefab by pulling it from the scene.

However, this breaks all Inspector links referencing this game object, so it's not OK.

How can I safely delete a child object of a prefab, with "safe" defined as "not breaking inspector links"?

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

1 Reply

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

Answer by whydoidoit · Jun 15, 2013 at 07:41 AM

Put the prefab in a scene, delete the child object, select the prefab instance in the hierarchy and click "Apply".

Note that indeed, even after you "break the prefab instance", the "Select" "Revert" "Apply" buttons DO STILL APPEAR. Strange but true.

alt text


screen shot 2013-06-15 at 08.40.56.png (11.3 kB)
Comment
Add comment · Show 10 · 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 Ted-Brown · Jun 17, 2013 at 05:27 PM 2
Share

Oh wow. That... that is terrible UI design on Unity's part. =) Deleting a child object in a scene breaks the connection to the prefab, so the natural expectation is that "apply" would no longer work, because there is no connection!

However, this worked perfectly. Thank you!

avatar image pea · Nov 11, 2013 at 09:37 AM 0
Share

Whoa, yeah. Teeeeerrible UI. Glad to read that you can actually do this though!

avatar image Demonicdaron · Aug 10, 2015 at 02:01 PM 0
Share

Just to confirm the UI bug, and to confirm the correctness of @whydoidoit 's answer

avatar image ovrdb · Sep 22, 2015 at 04:14 PM 0
Share

Really bad and misleading, Unity... but thanks for the info! It works!

avatar image Fattie · Nov 28, 2015 at 06:29 PM 0
Share

It has to be one of the weirdest things in Unity. I clicked "Reward User" and you should too! :)

Show more comments

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

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

Related Questions

Make a simple tree 1 Answer

Can I create a child gameobject on a prefab with an editor script 1 Answer

Editor Script: Linking GameObjects to public script variables resets when playing. 1 Answer

Need to make a reference in a prefab to itself not to the created instance 2 Answers

How to properly edit prefabs with child elements? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges