- Home /
object vs gameobject
While looking at images to show the class hierarchy for unity I ran across this image http://kimkijeung.com/blog/wp-content/uploads/2010/07/Unity3d-API-Hierarchy.png , and found out that an object and gameobject are not the same thing. So what is the difference between object and gameobject. Can someone give me an example of an object. Does it have anything to do with creating a new object like in javascript i.e. New Vector () for example?
Answer by Andres-Fernandez · May 14, 2014 at 07:48 AM
Object is the base class for all objects in Unity. It offers instantiation and destruction functions, but not much more.
GameObject, besides being a subclass of Object, is the base class for all entities within scenes. It has a Transform component by default, and can have other components attached.
Objects can be used in editor mode (for example) to get whatever you need in the input fields.
Answer by Noob_Vulcan · May 14, 2014 at 07:26 AM
K ....you are right gameobject and object are both different .
A GameObject is an object with a component "Transform". You can't remove this component from a gameobject. This thing makes it different from object.
Where as Object in simple terms is an instance of a class. e.g ClassA obj=new ClassA().This obj doesnt have any component like "Transform".
A class is a constuct/container to create your own custom types by grouping together variables of other types, methods and events.
And an object is used to access these variables or methods outside this class.
Your answer

Follow this Question
Related Questions
Unity3D Pressure Plate request. 3 Answers
Instantiating gameObject with custom Class properties 1 Answer
inspector,Component 0 Answers