PhotonView.Get(this)返回null

时间:2013-10-14 11:14:41

标签: windows-phone-8 unity3d photon

我将PUN 1.22集成到我的Unity3d wp8项目中。它构建正确,但是 PhotonView.Get(this)返回null。它能是什么?

public static PhotonView Get(Component component)
{
    return component.GetComponent<PhotonView>() as PhotonView;
}

public static PhotonView Get(GameObject gameObj)
{
    return gameObj.GetComponent<PhotonView>() as PhotonView;
}

1 个答案:

答案 0 :(得分:0)

忘记将PhotonView附加到我的GameObject

解决方案:

this.gameObject.AddComponent<PhotonView>();
photonView = PhotonView.Get(this);