Hey, so I'm trying to store some data about a player (specifically an ID used in a database, so it's not the same as TNet's ID), so I figured I could add this ID as an alias, like this:
TNManager.player.AddAlias(studentName);
TNManager.player.AddAlias(studentID);
TNManager.SyncPlayerData();
This seems to work if I check the aliases on the player on the local machine
foreach(string a in TNManager.player.aliases)
{
if(System.Int32.TryParse(a, out studentID))
Debug.Log ("Found student ID for player "+TNManager.playerName+": "+studentID);
}
But if I try to check the aliases on another player
foreach(string a in TNManager.GetPlayer(TNManager.objectOwnerID).aliases)
{
if(System.Int32.TryParse(a, out studentID))
Debug.Log ("Found other player's student ID: "+studentID);
}
It looks like aliases is null. It's getting the objectOwnerID properly and returns a non-null player, but it doesn't have the aliases list. I'm checking this in a void Awake() method. Am I doing something wrong? Or is there another way to store a custom variable to a player?
EDIT: For reference, I'm calling TNManager.player.AddAlias() before the player connects to the server, but I'm also setting TNManager.playerName at the same time and that's updating properly.