- Home /
Question by
yoethan642 · Mar 28, 2021 at 12:28 PM ·
multiplayerphotonmultiplayer-networking
Player keeps getting deleted in photon unity
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);
}
Comment