Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
3
Question by anwe · Jun 07, 2011 at 02:13 PM · javascriptparentingunparenting

How can I de-parent an object from another??

How can I de-parent an object from another?? i MEAN, if I have an object i which there are others, how can I deparent them??

Comment
Add comment · Show 2
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 anwe · Jun 07, 2011 at 02:34 PM 0
Share

ops, I'm really sorry, but why did you put me a thumb down? I didn't see it!!!

avatar image Bunny83 · Jun 07, 2011 at 04:48 PM 0
Share

I'm not sure why the ppl vote this down, but i think because:

  • There have been similar questions before

  • Your question isn't clear whether you want to do the detaching via script or manually in the editor.

You could edit your question to add some more details on what you want to do and where. $$anonymous$$aybe add some scripts/code snippets you've already tried. Also a quite useful information would be the (scripting-) language you prefer.

Downvoting without a comment why is not good practise. $$anonymous$$aybe if you improve the question they take it back.

4 Replies

· Add your reply
  • Sort: 
avatar image
16

Answer by Joshua · Jun 07, 2011 at 03:09 PM

If you don't want to detach children but de-parent an object (not sure from your question) you can simply use transform.parent = null;

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
5

Answer by Retribution · Jun 07, 2011 at 02:24 PM

Are you looking to do this through a script at runtime? Or are you wanting to do this through the editor/inspector?

If you're doing this through a script, you can use Transform.DetachChildren. Which script you would call this in would depend on which children/parents you want to be separated. The documentation for that is here: DetachChildren

If you want to do this through the editor, its a simple drag-and-drop for the items you wish to separate. Just click and drag the object out from beneath the parent, and drop it somewhere in the Hierarchy view.

Hope this helps

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 dhulihan · Jun 29, 2012 at 05:59 AM 0
Share

This was helpful for me. Thanks!

avatar image
2

Answer by flaviusxvii · Jun 07, 2011 at 02:21 PM

http://unity3d.com/support/documentation/ScriptReference/Transform.DetachChildren.html

PLEASE try searching first. This is a clearly documented function on the Transform page of the scripting reference.

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
2

Answer by unitcreator21 · Mar 30, 2020 at 07:01 PM

you can try this:

transform.SetParent(null);

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.

Follow this Question

Answers Answers and Comments

7 People are following this question.

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

Related Questions

Parenting and Unparenting a GameObject that has a Rigidbody 2 Answers

Parenting Objects 1 Answer

How to parent the state of a component with another one 0 Answers

Player won't stay on moving floor 2 Answers

How can I get a child object to read a variable held by the parent? 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