I didn't manage to find a good solution on my own so I ask for your advice. I simply want to create dataObject in bigDB and send a message to the player when it's done.
Here is a very simplified code of what I want to do :
- Code: Select all
public override void UserJoined(Player player)
{
base.UserJoined(player);
//creating the item
var obj = new DatabaseObject();
obj.Set("owner", player.ConnectUserId);
PlayerIO.BigDB.CreateObject("monsters", null, obj, sendMessage);
}
- Code: Select all
private void sendMessage(DatabaseObject o){
player.Send("info", "objectCreated"); //I can't do this because I have lost the reference to player
}
The problem is that I lose the reference to the player who just connected because of the callback.