如何将gameobject标签设置为null?

时间:2018-04-23 01:28:19

标签: unity3d

我正在使用碰撞器制作一个触发器来禁用脚本。问题是它完美有效,但在使用OnTriggerExit时,我不确定如何将Enemy Tag发送给null

public Casting stop;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}


private void OnTriggerEnter(Collider other)
{
    if (other.gameObject.tag == "Enemy")
    {
        Debug.Log ("is working trigger");
        stop.GetComponent<Casting> ().enabled = false;
    }

}

private void OnTriggerExit(Collider other)
{
    if (other.gameObject.tag != "Enemy")
    {
        Debug.Log ("is ended trigger");
        stop.GetComponent<Casting> ().enabled = true;
    }

}

}

0 个答案:

没有答案