When the player gets spawned, I can play but after sometime the player gets destroyed.
My Code:
private void Awake()
{
GameCanvas.SetActive(true);
}
// Update is called once per frame
private void Update()
{
PingText.text = "Ping: " + PhotonNetwork.GetPing();
}
public void SpawnPlayer()
{
float randomValue = Random.Range(-1f, 1f);
PhotonNetwork.Instantiate(PlayerPrefab.name, new Vector3(this.transform.position.x * randomValue, this.transform.position.y * randomValue), Quaternion.identity, 0);
GameCanvas.SetActive(false);
SceneCam.SetActive(false);
}