IT lexicon › Programming › GameObject

GameObject

Programming På svenska → Updated: 2026-10-26

Unity's basic building block: an empty container with a position that only becomes something once components are attached.

Everything in a Unity scene — the player, the camera, a light, an invisible trigger zone — is the same kind of object. On its own it does almost nothing: it has a name, a tag, a layer and, always, a Transform. Behaviour comes from components bolted on, and objects nest in a hierarchy where children move with their parent. The design favours composition over inheritance, which is why a prefab can be literally anything.

Two classic traps: GetComponent and Find are expensive if called every frame, and Unity overloads == so that a destroyed object compares equal to null even though the C# reference is still alive. This "fake null" has made countless developers question their sanity.

← Back to the lexicon