Player not Spawning in
Options
I am trying to set up a networking system for my game and I have written all the code for Photon (or at least I thought I have) but I put my player prefab into a folder named "Resources" and I attached the Photon View script to it. Also I have made a spawn point for it and called for it in the script, but when ever I click play it just comes up as the scene is missing a fullscreen camera. Here's my script
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
const string VERSION = "v0.0.1";
public string roomName = "BaseWars";
public string playerPrefabName = "PlayerBlue";
public Transform spawnPoint;
// Use this for initialization
void Start()
{
PhotonNetwork.ConnectUsingSettings(VERSION);
}
void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate(playerPrefabName, spawnPoint.position, spawnPoint.rotation, 0);
}
}
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
const string VERSION = "v0.0.1";
public string roomName = "BaseWars";
public string playerPrefabName = "PlayerBlue";
public Transform spawnPoint;
// Use this for initialization
void Start()
{
PhotonNetwork.ConnectUsingSettings(VERSION);
}
void OnJoinedLobby()
{
RoomOptions roomOptions = new RoomOptions() { isVisible = false, maxPlayers = 4 };
PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, TypedLobby.Default);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate(playerPrefabName, spawnPoint.position, spawnPoint.rotation, 0);
}
}
0
Best Answer
-
I have solved my own question lol. All you have to do is replace OnJoinedLobby with OnConnectedToMaster5
Answers
-
I have solved my own question lol. All you have to do is replace OnJoinedLobby with OnConnectedToMaster5