- Home /
Question by
infernogamesrs · Aug 24, 2015 at 11:26 AM ·
networkingphoton
Photon Instantiate messes up the camera
When I instantiate my player prefab using PhotonNetwork class I can't move the camera up or down just left and right.For the prefab I'm using the standard assets first person character controller. Here is my code:
using UnityEngine;
using System.Collections;
public class NetworkManager : MonoBehaviour {
SpawnSpot[] spawnSpots;
// Use this for initialization
void Start () {
spawnSpots = GameObject.FindObjectsOfType<SpawnSpot>();
PhotonNetwork.autoJoinLobby = true;
Connect ();
}
void Connect(){
PhotonNetwork.ConnectUsingSettings ("Alpha 0.0.1");
}
void OnGUI(){
GUI.Label (new Rect(0,0,100,50),PhotonNetwork.connectionStateDetailed.ToString());
}
void OnJoinedLobby(){
Debug.Log ("Lobby!");
PhotonNetwork.JoinRandomRoom ();
}
void OnPhotonRandomJoinFailed(){
Debug.Log ("Failed Join!");
PhotonNetwork.CreateRoom (null);
}
void OnJoinedRoom(){
Debug.Log ("Joined!");
SpawnMyPlayer ();
}
void SpawnMyPlayer(){
SpawnSpot mySpawnSpot = spawnSpots[Random.Range(0,spawnSpots.Length)];
GameObject GO = PhotonNetwork.Instantiate ("FPSPlayer",mySpawnSpot.transform.position,mySpawnSpot.transform.rotation,0);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612001002im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Photonnetwork check when somebody connects/disconnects 2 Answers
Unity Character Move Over PhotonNetworking 0 Answers
Synchronize array with simultaneous access via Photon Network RPC 1 Answer
Photon Networking Spawn player 2 0 Answers
Photon Networking (Viking Demo) - GetRoomList() func not working 2 Answers