Player values can only be set by the player in question. You can't set other players' data.
Channel values should be set by the host, although it's up to you how to handle that. Easiest approach is to simply check for TNManager.isHosting in your code.
For anything custom, if you want simplicity, I suggest handling it the same way I have TNObject.Set work:
public void Set (string name, object val)
{
if (isMine) OnSet(name, val);
else Send("OnSet", ownerID, name, val);
}
[RFC]
void OnSet (string name, object val)
{
if (mData
== null) mData
= new DataNode
("ObjectData"); mData.SetHierarchy(name, val);
OnSetData(mData);
Send("OnSetData", Target.OthersSaved, mData);
}
[RFC]
void OnSetData (DataNode data)
{
mData = data;
if (onDataChanged != null) onDataChanged(data);
}
In other words, if this is the player that should be doing this sort of thing, set it directly. Otherwise send an RFC to the player that should be doing this to perform the action. In the first RFC you update the data, then send the updated value to everyone else.
This approach ensures simplicity, while forcing all data to go through one player, thus eliminating race conditions.