Object.operator == Manual     Reference     Scripting  
Scripting > Runtime Classes > Object
Object.operator ==

static operator == (x : Object, y : Object) : boolean

Description

Compares if two objects refer to the same

JavaScript
var target : Collider;
function OnTriggerEnter (trigger : Collider) {
if (trigger == target)
print("We hit the target trigger");
}

Get early out if there is no target.
JavaScript
var target : Transform;
function Update () {
// Early out if the target is gone
if (target == null)
return;
}