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
0
Question by MichaelMcFarland · May 17, 2014 at 05:20 AM · gameobjectcreate

Possibly to create a game object inside of another game object?

Whenever I create a blank game object it always appears on the outer most level of the hierarchy. I would like to be able to create a new blank game object inside of the object I currently have selected. Is that possible?

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

2 Replies

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

Answer by rgowen · May 17, 2014 at 05:25 AM

All you have to do is create the empty GameObject. Then in the Hierarchy, drag and drop it onto the GameObject you want to add it to.

Comment
Add comment · Show 4 · 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 MichaelMcFarland · May 17, 2014 at 06:22 AM 0
Share

But that's exactly what I don't want to do. The part I don't like is that if I'm creating lots of game objects and have lots of objects in my project it gets tedious dragging every new game object into the object I want to be under.

avatar image rgowen · May 17, 2014 at 07:12 AM 0
Share

Did some quick Googling and found this:

http://forum.unity3d.com/threads/77444-How-to-create-new-GameObject-as-child-in-hierarchy?p=820181&viewfull=1#post820181

avatar image MichaelMcFarland · May 17, 2014 at 07:01 PM 0
Share

That looks exactly like what I want! I'll see if I can get it working, I didn't know Unity let you override how it works.

avatar image rgowen · May 17, 2014 at 11:20 PM 0
Share

Yeah, I haven't gotten into Editor extensions too much yet, but from what I've seen they can be extremely powerful.

avatar image
0

Answer by Noob_Vulcan · May 17, 2014 at 07:20 AM

    GameObject obj = Instantiate (Bubble, transform.localPosition, Quaternion.identity)) as GameObject;
    obj.transform.parent = other_obj.transform;

This will make "obj" child of "other_obj"

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 MichaelMcFarland · May 17, 2014 at 07:02 PM 0
Share

That's not what I was trying to do, but it's good to know how to do it in scripting. Thanks!

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

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

Any way to create a gamobject only if there is an empty space? 1 Answer

Adding local created rigedbody to gameobject 1 Answer

Parent everything to gameobject 2 Answers

How could I create a prefab from an exsisting gameobject at runtime? 2 Answers

GameObject.find("name") doesn't work if executed in the same loop of... 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