- Home /
Player sometimes gets other Players name on ChatBox?
So, I've recently stumbled upon another problem, and I'm not sure what's causing it.
I have a basic Photon multiplayer game setup, with the default photon chatbox script, along with my other stuff.
I have a very basic login, that the player types in his/her name before clicking join. It assigns them a name tag, and it SEEMS to assign them their name in the chatbox, but sometimes when chatting, you'll get the name of someone else in that lobby/room/game?
Example, there's 4 players in game, Todd, Bill, Frank, and Jack.
Sometimes when Bill types and presses enter to send the message, it displays that either Frank, Jack, or Todd sent it?
Also, only the person who sent the message sees it, meaning its client sided?
Not really sure what to do, if I need to post my scripts I'd be happy to. Just need some help! :)
Alright so I'm still having trouble with this.
Here's my Game$$anonymous$$anager script
using UnityEngine;
using System.Collections;
public class Game$$anonymous$$anager : Photon.$$anonymous$$onoBehaviour {
public Transform PlayerPrefab;
public string PlayerName;
public Transform PlayerSpawn;
void Start ()
{
PhotonNetwork.ConnectUsingSettings("alpha 0.4");
}
public void OnGUI()
{
PlayerName = GUILayout.TextField(PlayerName, 20);
if(GUILayout.Button("Join Lobby"))
{
PhotonNetwork.JoinRandomRoom();
}
}
void Update()
{
PhotonNetwork.player.name = PlayerName;
}
void OnPhotonRandomJoinFailed()
{
PhotonNetwork.CreateRoom(null);
}
void OnJoinedRoom()
{
PhotonNetwork.Instantiate("PlayerPrefab", PlayerSpawn.position, Quaternion.identity, 0 );
GetComponent<InRoomChat>().enabled = true;
}
}
I'm not sure what's causing this.. Very strange indeed.