using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using System.IO; public class PlayerManager : MonoBehaviour { PhotonView PV; GameObject controller; void Awake() { PV = GetComponent(); } // Start is called before the first frame update public void Start() { if (PV.IsMine) { CreateController(); } } public void CreateController() { Transform spwanpoint = SpawnManager.Instance.GetSpawnpoint(); //controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), spwanpoint.position, spwanpoint.rotation); //controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), spwanpoint.position, spwanpoint.rotation, 0, new object[] { PV.ViewID }); controller = PhotonNetwork.Instantiate(Path.Combine("PhotonPrefabs", "PlayerController"), transform.position, transform.rotation, 0, new object[] { PV.ViewID }); } public void Die() { PhotonNetwork.Destroy(controller); CreateController(); } }