- Home /
Photon Problem
I get the following bug with PUN, when another player joins the room it`s like it`s the same player as the first, i mean the first player starts experiencing moving true walls randomly without touching the keyboard. Everything else is working great, this is the only problem i have. I was tinking maybe i need to give a separate series to each player, i mean like an ID... Any ideas ?
Screenshoot Here : https://www.dropbox.com/s/duo0agnditx41xd/Screenshot%202014-08-02%2016.54.10.png
and the game manager script :
public class AU_GameManager extends Photon.MonoBehaviour {
var myCustomProp : String;
var connectedPlayerList : Array = new Array(PhotonPlayer);
private var playerName : String;
var levelCamera : Camera;
var audioListener : AudioListener;
var pv : PhotonView;
var allSpawnPoints : GameObject[];
@HideInInspector
var playerInGame : boolean;
function Awake () {
PhotonNetwork.isMessageQueueRunning = true;
playerName = PhotonNetwork.player.name;
//Example how to use custom properties.
//Set:
//var setCustomProp : ExitGames.Client.Photon.Hashtable = new ExitGames.Client.Photon.Hashtable();
//setCustomProp.Add("MyString", myCustomProp);
//PhotonNetwork.room.SetCustomProperties(setCustomProp);
//Get:
myCustomProp = PhotonNetwork.room.customProperties["MyString"];
}
function SpawnPlayer(){
var spawnPoint : GameObject = allSpawnPoints[Random.Range(0, allSpawnPoints.Length)];
var nPlayer : GameObject = PhotonNetwork.Instantiate("soldier3rdPersonRed", spawnPoint.transform.position, spawnPoint.transform.rotation, 0);
if(playerInGame == false){
// nPlayer.GetComponent("PlayerConfig").LocalPlayer();
nPlayer.name = playerName;
LevelCamera(false);
playerInGame = true;
}
}
function LevelCamera(action : boolean){
levelCamera.enabled = action;
audioListener.enabled = action;
}
///////////////////////////
// Photon Functions
///////////////////////////
function OnLeftRoom () {
Debug.Log ("*** OnLeftRoom ()..... Called once the local user left a room.");
LeftRoom();
}
function OnDisconnectedFromPhoton () {
Debug.Log ("*** OnDisconnectedFromPhoton ().... Called after disconnecting from the Photon server. In some cases, other events are sent before OnDisconnectedFromPhoton is called.");
LeftRoom();
}
function LeftRoom(){
PhotonNetwork.isMessageQueueRunning = false;
Application.LoadLevel ("MainMenu");
}
function OnPhotonPlayerConnected () {
Debug.Log("*** OnPhotonPlayerConnected()..... Player Connected.");
}
}
It might be that your control script is running on all instances of everyone's character (your own and on the character that another player instantiated).
In the $$anonymous$$arco Polo Tutorial I describe a similar problem and a solution. $$anonymous$$aybe that helps.