[SOLVED] PhotonNetwork.Instantiate cannot spawn players
So i have been using unity for 2 years now and last year i begun learning multiplayer. In my case i found out that photon would be ht best for me. So i am experimenting with it. But i have an issue, I want to use PhotonNetwork.Instantiate(); but it won't work. The player prefab is in a Resources folder and i have 0 errors. Here is my Player Spawning Script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun;
public class PhotonSpawn : MonoBehaviourPunCallbacks { // Start is called before the first frame update void Start() { if (PhotonNetwork.IsConnectedAndReady) { PhotonNetwork.Instantiate("Player", Vector3.zero, Quaternion.identity); } }
 // Update is called once per frame
 void Update()
 {
     
 }
}
And here is my NetworkManager Script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; using Photon.Realtime;
public class PhotonNetworkManager : MonoBehaviourPunCallbacks { // Start is called before the first frame update void Start() { PhotonNetwork.ConnectUsingSettings();
 }
 public override void OnConnectedToMaster()
 {
     Debug.Log("Connected To Master Server");
 }
 // Update is called once per frame
 void Update()
 {
     
 }
 public void Online()
 {
     PhotonNetwork.JoinRandomRoom();
     if (PhotonNetwork.IsConnected)
     {
         PhotonNetwork.LoadLevel(1);
         
     }
 }
 public override void OnJoinRandomFailed(short returnCode, string message)
 {
     RoomOptions r = new RoomOptions();
     r.MaxPlayers = 10;
     r.IsOpen = true;
     r.IsVisible = true;
     PhotonNetwork.CreateRoom(Random.Range(0, 9999999).ToString(), r, TypedLobby.Default);
     if (PhotonNetwork.IsConnected)
     {
         PhotonNetwork.LoadLevel(1);
        
     }
     
 }
 
 
}
Any help would be appriciated
(Sorry for bad english)
Your answer
 
 
             Follow this Question
Related Questions
Unity Photon Handle Match Data 0 Answers
How to sync RPC function Photon Network? 1 Answer
How to Update Objects Sprite to the Network 1 Answer
Join the oldest match (world wide) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                