- Home /
Unity IDE: Finding out object type of arbitrary item in Hierarchy
Unity IDE: Is there a way to tell an object type (is it a sphere, plane, cube, empty? etc) of an arbitrary object in Hierarchy (without clicking on each one)?
Also, when you remove components from an object - such as mesh filters, you can't tell if something is a cube easily... even if you try zooming in on it, another object (in a complicated scene, especially!) might be blocking it from easy view
Answer by Jessy · Dec 30, 2010 at 06:43 AM
Those are not "objects types". Those are shapes of a mesh, and matching colliders, easily created with menu items or GameObject.CreatePrimitive. All Game Objects in your scene are the same thing; the only component they are required to share is a Transform, but on top of that, the components you add are what differentiate them. There is no "sphere game object" or "cube game object".
You can not remove a mesh filter and have something be a cube; there is no mesh then, cube or no cube! Your best bet for keeping your sanity with scenes with many game objects and complex nesting, is to name and parent things logically, and use tags.
Something can look like a cube but have no cube meshfilter etc... Also, my question is referring to the gameobject list in hierarchy pane in general
No, it can't. "Look like" requires rendering; rendering requires a mesh filter or skinned mesh renderer. That doesn't help understand your "question"; I don't believe you really have a question; I think you're misunderstanding the game object + component system.
yes. the trick to the spoon is knowing there is no spoon. Jessy your answer is genius. its the first time I can see thru the looking glass. thankyou!!!!
btw. Unity take this information in Jessy's answer and learn to shout about this aspect of your engine throughout the documentation. You'll help more than you know. $$anonymous$$aybe have Jessy word it. He seems to be the copywriter you need. ::: http://unity3d.com/company/jobs/?jvi=o4BtVfwN,job :::
Answer by brett nieland · Jan 04, 2014 at 04:25 PM
For you programmers out there, Unity composes objects instead of deriving them from GameObject. Thus, what differentiates the "GameObject types" is the collection of components they contain, not some derived class.
So, when you hit GameObject>CreateOther>Cube on the menu, you are just creating a GameObject that has a set of components attached to it by default. In the case of a cube, they are a Transform, Mesh Filter, Box Collider, and a Shader.
You would have the exact same result if you created an empty GameObject and added these components to it one by one.
note: I am pretty new to Unity, so if I have any details wrong, please let me know!