photonview call on start method in unity
Options
Hey,
I created a Photon lobby scene where my players can connect to a room. When two players are in a room the game scene get's loaded. In this game I put a gameObject with a PhotonView script on.
When the game scene is loaded it gives an error on the photonView in the start method.
When I use the CallTest() method a few second later all works fine.
Question is, Can I detect in the game scene when the photonView is ready for use?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class PlayerNetworkPun : MonoBehaviourPunCallbacks
{
private void Start()
{
Debug.Log ("Start: " + photonView.Owner.NickName.ToString ());
}
public void CallTest()
{
Debug.Log ("Call: " + photonView.Owner.NickName.ToString ());
}
}
I created a Photon lobby scene where my players can connect to a room. When two players are in a room the game scene get's loaded. In this game I put a gameObject with a PhotonView script on.
When the game scene is loaded it gives an error on the photonView in the start method.
When I use the CallTest() method a few second later all works fine.
Question is, Can I detect in the game scene when the photonView is ready for use?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
public class PlayerNetworkPun : MonoBehaviourPunCallbacks
{
private void Start()
{
Debug.Log ("Start: " + photonView.Owner.NickName.ToString ());
}
public void CallTest()
{
Debug.Log ("Call: " + photonView.Owner.NickName.ToString ());
}
}
0
Comments
-
Never mind. I made a setup mistake.
I love Photon. Very intuitive and easy to use.0