So, I’m sending some info to the server using a syncvar. No big deal. However, I like trigger events when a field changes. Like so:
private string _blah;
public string blah
{
get { return _blah; }
set
{
if(value != _blah)
{
_blah = value;
OnBlahChanged(); // trigger the event handler
}
}
}
But I’m not sure how to do that with SyncVars. I mean, I guess I could call two functions when I send the value to the server, like so:
[Command]
CmdSendToServer(string something)
{
blah = something;
}
[Command]
CmdCheckIfBlahChanged()
{
// do some previous / current checking here and then trigger events on the server side
}
This seems stupid and bad. There’s got to be a better way.