Code: Select all
if (user.GetId() != client.myUserId) {
var uVars : Hashtable = user.GetVariables();
var debugString : String = "User " + user.GetId() + " variables: ";
for (var uVar : String in uVars.Keys) {
debugString += uVar + ", ";
}
Debug.Log(debugString);
// ... and so on
The debug statement shows no variables for the user. In the same function, after other player's avatars are created locally, I instantiate a localAvatar with the FPSWalker and the following script attached:
Code: Select all
var smartFox : SmartFox;
var myPos : Hashtable = new Hashtable();
var myOldPos : Vector3;
function Awake () : void {
smartFox = GameObject.FindObjectOfType(SmartFox);
myOldPos = transform.position;
}
function Start () : void {
myPos.Add("px", transform.position.x);
myPos.Add("py", transform.position.y);
myPos.Add("pz", transform.position.z);
smartFox.client.SetUserVariables(myPos);
}
function FixedUpdate () : void {
if (myOldPos != transform.position) {
myPos["px"] = transform.position.x;
myPos["py"] = transform.position.y;
myPos["pz"] = transform.position.z;
smartFox.client.myRoom.GetUser(smartFox.client.myUserId).SetVariables(myPos);
myOldPos = transform.position;
}
}
Am I doing something wrong in setting user variables? I couldn't find an example of setting user vars in the Unity specific tutorials, so I'd appreciate any guidance in the matter. Thanks in advance.