Hi all, I am working at the Bootcamp demo (Photon Multiplayer) example and I found out that it uses only one level which combine both Menu and Game scene. I am trying to seperate them into different levels as Menu and Scene always needs to be seperated to avoid potential complexes in future development. I've got a few questions which is a Unity Specific.
Q1 .. When I tried to seperate Menu and Game Scene, photon connection is lost as it seems to be destroyed when the new scene loaded. To maintain the connection along the game levels, I use the static variables on the following class
public class PhotonManager : MonoBehaviour { public static TNPhoton photon = null;
void Awake()
{
photon = (TNPhoton)gameObject.AddComponent<TNPhoton>();
}
}
Unfortunately it's not working as the photon object is not known when the new game level is loaded.
Secondly, after the first method is not solved my problem, I maintain the component by using
DontDestroyOnLoad(photon);
and also doesn't maintain the connection and I even got other errors by doing this.
Can anyone help me to solve this problem?