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 D3mux · Feb 28, 2012 at 01:15 AM · gameobjectencapsulation

Gameobject into another Gameobject

Hi everybody, i'm new to unity and i'm just trying some functions atm. There is a thing that i'm not able to understand also with guides, tutorials and docs: How can i insert Gameobjects "B", "C", "D", ... into a GameObject "A"? I mean something like the Flame GameObject provided with the standard assets. Flame is a gameobject with only Transform as component, and in the project hierarchy it appears to have 4 objects inside it, 3 of these contain components Transform and Particle Emitter and the fourth is a "Light" object with components Transform and Light. So 4 distinct gameobject into a parent gameobject. I'd like to create something similiar, so that i can encapsulate in a single gameobject more gameobjects. All this through the editor interface, is it possible? I tried to drag an object "A" over another "B", but the result is that the destination object just get a copy of "A" components.

Thank you

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 aldonaletto · Feb 28, 2012 at 02:58 AM 0
Share

To child the object A to B, just drag A over B in the Hierarchy view: A will be moved "inside" B, meaning B is its parent.
When your object is ready, you can drag it to the Project view, what will create a prefab of it.

avatar image D3mux · Feb 28, 2012 at 08:31 AM 0
Share

@aldonaletto: this is exactly what i neede, thank you! (i don't know how to vote your answer, a comment isn't votable right?)

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Feb 28, 2012 at 02:20 AM

You are confusing Components and GameObjects. GameObjects contain Components. Transform is a Component. So are those other things. Transforms can also contain other Transforms (hierarchical parenting).

You can create an 'empty' game object (it will have a Transform, they all do), then add Components (from the Component menu, or drag/drop).

If you have something built up and want lots of copies of that, create a Prefab, then drop your game object onto that Prefab (in the Project view) and it makes a Prefab you can then drop lots of into your scene/hierarchy view.

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 D3mux · Feb 28, 2012 at 08:38 AM 0
Share

I know the difference, probably i explained bad my needings. Anyway what i meant is to have more gameobjects (may them be spheres, cubes...) into a parent gameobject (a gameobject with only Transform as Component) so that moving around the parent, all his gameobject children move with him staying in a fixed position of a relative subspace (the space inside the parent object). I got my answer reading the comment above by aldonaletto, i was tring to drag the gameobject in the project view, but i had to do that in the Hierarchy view insted. Thank you all!

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

6 People are following this question.

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

Related Questions

using Contains(gameObject) to find and destroy a gameObject from a list 2 Answers

How to structure code for squad selection and movement 0 Answers

Enable and object after disable 0 Answers

Script to Keep One GameObject from Being Destroyed 0 Answers

How do I stop an immediate collision with all objects from ocuring at the entry of game mode? 0 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