x | The first Object. |
y | The Object to compare against the first. |
Compares if two objects refer to the same.
var target : Collider; function OnTriggerEnter (trigger : Collider) { if (trigger == target) print("We hit the target trigger"); }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { public Collider target; void OnTriggerEnter(Collider trigger) { if (trigger == target) print("We hit the target trigger"); } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): public target as Collider def OnTriggerEnter(trigger as Collider) as void: if trigger == target: print('We hit the target trigger')
var target : Transform; function Update () { // Early out if the target is gone if (target == null) return; }
using UnityEngine; using System.Collections; public class Example : MonoBehaviour { public Transform target; void Update() { if (target == null) return; } }
import UnityEngine import System.Collections public class Example(MonoBehaviour): public target as Transform def Update() as void: if target == null: return
null
.e.g.GameObject go = new GameObject(); Debug.Log (go == null); // falseObject obj = new Object(); Debug.Log (obj == null); // true
true
to null
.