Hi,
I’m actually working on a project with SmartFoxServer and Unity3D.
Here the little snippet:
void OnPublicMessage(BaseEvent e) {
User sender = (User)e.Params["sender"];
message = (string)(e.Params["message"]+sender.Name);
string[] cmd = message.Split(':');
if (cmd[0]=="New" && cmd[1]==sender.Name) {
GameObject newPlayer = Instantiate(prefab,new Vector3(2,2,2), Quaternion.identity) as GameObject;
InformationSheet Info = newPlayer.GetComponent<InformationSheet>();
Info.UserName=cmd[1];
}
}
When I run the project it creates a new gameobject (prefab), but the variable in the script ob this gameobject doesn’t change.
BTW: The message is “New:Guest#XX” so that script knows that a new player named Guest#XX connected.