Hi Mihir,
In the Viking Demo project, we are already checking this functionality. We are doing this like:
First, we are copying the username along with the position, rotation and velocity of the gameObject to the byte array (which we are passing as an argument in sendBytes method) through these line:
int data_len = (sizeof(float)*9) + (username.Length*sizeof(char));
byte[] data = new byte[data_len];
System.Buffer.BlockCopy(username.ToCharArray(),0,data,sizeof(float)*9,username.Length*sizeof(char));
Now, when we get the response callback in the onBytes method of the appwarp class, we are checking sender like this:
char[] data_c = new char[(msg.Length - (sizeof(float)*9))/sizeof(char)];
System.Buffer.BlockCopy(msg,sizeof(float)*9,data_c,0,msg.Length - (sizeof(float)*9));
string sender = new string(data_c);
if(sender != username){
//I am not the sender
}
Currently the above check is written in onBytes method of the AppWarp class, which is getting called from onUpdatePeersReceived method of the Listener class. You can put the same kind of check for the object you are creating either in onUpdatePeersReceived or in onBytes mehod as per your requirement.
Let us know if you face any problem.
Thanks & Regards,
Sumit