Unity3D,为什么我不能从不同的场景中找到GameObject?

时间:2017-05-09 13:15:45

标签: c# unity3d

当我从活动场景访问GameObject时,它可以工作:

GameObject.Find("Something").GetComponent<InputField>().text

然而,从一个链接到另一个场景的剧本来看,它并没有。

我已确保添加DontDestroyOnLoad (gameObject),但我无法访问它,为什么?

private void Start () 
{
    Instance = this;

    //not destroying it when changing scene
    DontDestroyOnLoad (gameObject);
}

0 个答案:

没有答案
相关问题