Game Object Signals#
Game Object Signals identify which scene object an Instruction reads or changes. They resolve Event context, direct references, scene searches, hierarchy relationships, components, cursor hits, and collection entries.
Context#
Two entries appear near the top of every Game Object dropdown, covered in full in Source & Target:
| Entry | Resolves to |
|---|---|
| Source | The object holding the Event that's running. |
| Target | The other object involved. |
Use Source or Target when the Event's context already provides the object you need. The Event can then run for different prefab instances without a separate object reference for each one.
Direct references#
Use these sources to select an assigned reference, read a stored one, or clear a destination:
| Source | Resolves to |
|---|---|
| Instance | A specific object you drag into the field. |
| Prefab | A prefab asset, for instantiation. |
| Variable | Whatever object a variable currently holds. |
| None | Nothing. Useful for deliberately clearing a Set field. |
Prefab assets can't reference scene instances
A direct Instance reference points at a specific object. A prefab asset can't store a reference to an object in a scene. Use Target, a tag lookup, or a variable to resolve the object at runtime.
If a scene load destroys the referenced object, resolve the new object before using it.
Finding objects#
These sources search the scene for the first matching object:
| Source | Finds |
|---|---|
| Find by Name | The first object with a given name. |
| Find with Tag | The first object carrying a tag. |
| Find with Component | The first object that has a given component type. |
Scene searches have a runtime cost. If you need the same result repeatedly, search once during setup and store the result in a variable instead of searching inside On Update.
Hierarchy#
Hierarchy sources resolve an object relative to another transform:
| Source | Resolves to |
|---|---|
| Parent | The object's parent. |
| Root | The topmost ancestor. |
| Child | A child by index. |
| Child by Name | A child by name. |
Components#
Component Signals resolve to the game object holding a particular component, such as Character Controller, Event, or Local Variable. Packages can add entries for their own components.
Main Camera, under Components → Camera, resolves the camera tagged MainCamera. Use it for screen-to-world conversion, visibility checks, spawning at the camera, or orienting a UI element.
Main Camera requires the MainCamera tag
Main Camera resolves through Unity's MainCamera tag. A scene where no camera carries that tag resolves to nothing, and a scene with two of them resolves to whichever Unity finds first.
Cursor and selection#
These sources resolve the object under the pointer or the UI element with focus:
| Source | Resolves to |
|---|---|
| Cursor Physics 3D | The 3D object under the pointer. |
| Cursor Physics 2D | The 2D object under the pointer. |
| Cursor UI | The UI element under the pointer. |
| Selected UI | The currently focused UI element. |
The two physics options cast into the scene, so they respect layers and colliders. Use them to select an object on click, highlight it on hover, or choose an object to drag.
From a collection#
Given a collection of objects, these pick one out:
| Source | Picks |
|---|---|
| First | The first entry. |
| Last | The last entry. |
| Random | A random entry. |
| Closest | The entry nearest to a reference point. |
| Farthest | The entry furthest from a reference point. |
Combine these selectors with a physics collection to find objects such as the nearest enemy within five meters. That example uses Closest with an overlap sphere collection.
Loop item#
Inside a Foreach, the current item is available as a Game Object Signal when the collection holds objects. Foreach also sets Target to that item, so the explicit loop Signal is often unnecessary.
Set Signals#
Game Object Signals also appear in Set fields, where the question is where should this object reference be stored? The usual destination is a variable.
Where to go next#
- Collections — produce the lists these Signals select from.
- Source & Target — understand the Event's object context.
- Pooling — reuse instantiated objects instead of recreating them.