Code: Select all
Debug.Log("[NetMgr] OnRoomJoined");
if(room.GetName() == G_PlayerMgr.instance.GetUsername()){
Debug.Log("[NetMgr] Joining My Own Room");
//Set Room Variables
ArrayList rVars = new ArrayList();
rVars.Add(new RoomVariable("oid", G_PlayerMgr.instance.playerData.mem_id.ToString(), false, false));
sfClient.SetRoomVariables(rVars);
Hashtable uVars = new Hashtable();
uVars.Add("id", G_PlayerMgr.instance.playerData.mem_id.ToString());
uVars.Add("gen", G_PlayerMgr.instance.playerData.gender);
sfClient.SetUserVariables(uVars);
Debug.Log("[NetMgr] OnRoomJoined... User Joined Their Own Room. Starting Layout Load...");
G_LayoutMgr.instance.loadHome();
}//if
else{
//Get The New Rooms Owner ID
Debug.Log("[NetMgr] Joining Remote Room: " + room.GetName());
Hashtable roomVars = room.GetVariables();
int owner_id = int.Parse((string)roomVars["oid"]);
G_LayoutMgr.instance.loadActiveLayout(owner_id);
}//else
The SetUserVariables throws back an acception: " Exception: System.NullReferenceException: Object reference not set to an instance of an object".
I know the variables I'm putting into the hashtable are fine and even tried putting in direct string values and continue to get this error. If I comment out the setuservariables line everything goes through fine with no error. The setRoomVariables above it works fine and does set the room variables. I even tried commenting that out to see if there was in an issue trying to set both variable types in the same block and that didn't make a difference.
I'm using Unity 2.5, SmartFox 1.6.6 and the latest api.