I am trying to create a Demo scene where basically there is a sphere game object with the name “SferaMortii”. Through input from keyboard, that object only moves around. That is all it has to do and I am trying to make a multiplayer version in order for me to get used to Photon.
I have followed a tutorial that told me to attach a PhotonView Script to the player prefab, I have made a Resources Folder and inside I have moved the prefab, I have made a NetworkManager scrpt where I described the room options,etc. and then I used the Photon.Instantiate function.
I have followed all the steps and when running the game, the object doesn’t instantiate and moreover I get this error:
SwitchToProtocol: Udp PhotonNetwork.connected: False
UnityEngine.Debug:Log(Object)
PhotonNetwork:SwitchToProtocol(ConnectionProtocol) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1172)
PhotonNetwork:ConnectUsingSettings(String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonNetwork.cs:1219)
NetworkManager:Start() (at Assets/Scripts/Network/NetworkManager.cs:12)
My script for the NetworkManager is the following:
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
const string VERSION="v0.0.1";
public string roomName="MyRoom";
public string playerPrefabName="SferaMortii";
public Transform spawnPoint;
void Start () {
PhotonNetwork.ConnectUsingSettings (VERSION);
}
void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions (){ IsVisible = false, MaxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom (roomName, roomOptions, TypedLobby.Default);
PhotonNetwork.Instantiate (playerPrefabName,
spawnPoint.position,
spawnPoint.rotation,
0);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate (playerPrefabName,
spawnPoint.position,
spawnPoint.rotation,
0);
}
}
Should you have any useful advice or any observations, please help troubleshoot the problem!