Question by
xCMurder · Mar 23, 2016 at 12:27 AM ·
unity 5networkingmultiplayernetworkphoton
Unity Photon doesn't Spawn Player
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);
}
}
Comment
Your answer
Follow this Question
Related Questions
Photon ccu question 0 Answers
How do I sync Rigidbody2D over the network? 0 Answers
Communication between Photon Cloud game and web server 0 Answers
Players won't spawn with Photon Unity Network 1 Answer
UNET | How to use network messages? 1 Answer