[SOLVED] Difference between Object x GameObject

Hi Guys,

I did both challenges but in the second one, that we were supposed to change the color of the smoke, I got stuck in the error that Ben also got. Than, I watched the solution and saw that he fixed it with a “as GameObject” at the end and explained that the result of Instantiate is an Object, and not a GameObject.
But I did’t really got what’s the difference of an Object and a GameObject? I thought it was the same thing.

An Object is more general: gameobjects, components, and other things can be objects. A GameObject is specifically something that can appear in the Hierarchy window (by default to the left of the scene/game windows). (and a Component, a different kind of object, can appear in the Inspector–in the default layout, to the right of the scene and game windows–attached to a GameObject, for example).

To be sure I wasn’t lying to you, I checked https://docs.unity3d.com/ScriptReference/Object.html and yep, an Object can either be a GameObject, Component, or Asset.

ETA to find links like that one, google for things like “unity3d object”—use unity3d rather than unity to keep from getting other meanings of “unity”.

1 Like

Object refers to a particular instance of a class, the scripts you make in monodeveloper. A object can be a combination of variables, functions, and data structures.

In a object-oriented programming language (like C++, C# or Java), almost everthing is an object. A game object is a specific type of object used by unity.

2 Likes

Privacy & Terms