Vladislav
Vladislav

Reputation: 297

PhotonView.Get(this) returns null

I integrate PUN 1.22 to my Unity3d wp8 project. It builds correct, but PhotonView.Get(this) returns null. What can it be?

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

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

Upvotes: 1

Views: 1077

Answers (1)

Vladislav
Vladislav

Reputation: 297

Just forget to attach PhotonView to my GameObject

The Solution:

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

Upvotes: 1

Related Questions