Object.operator == 等于
static operator == (x : Object, y : Object) : bool
Description描述
Compares if two objects refer to the same
比较如果两个物体相同。
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");
}
}
var target : Collider;
function OnTriggerEnter (trigger : Collider) {
if (trigger == target)
print("We hit the target trigger");
}
Get early out if there is no target.
如果没有目标提前退出代码
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public Transform target;
void Update() {
if (target == null)
return;
}
}
var target : Transform;
function Update () {
// Early out if the target is gone
//如果没有目标则提前退出代码
if (target == null)
return;
}
最后修改:2010年12月9日 Thursday 0:11