【发布时间】:2017-05-05 05:17:49
【问题描述】:
我有一个名为“trigger.cs”的脚本。此脚本附加到预制件中的对象。预制件在运行时被实例化。
此外,如果我能以某种方式对“死亡菜单”进行硬编码,那也是一种解决方案。
这是我的 trigger.cs 文件
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class trigger : MonoBehaviour {
public Text scoreText;
public Death deathMenu;
//the line below is commented because its not working for me and just throws an error.
//public Death deathMenu = GameObject.Find("Death Menu");
void Start(){
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider othercollider){
Debug.Log ("You Are Dead !");
}
}
【问题讨论】: