//from the server: a NetVariable changed
    public void OnSetVariables(SocketIOEvent e)
    {
        NetVariables data = JsonUtility.FromJson<NetVariables>(e.data.ToString());
        
        if (Net.objects.ContainsKey(data.uniqueId))
        {
            NetObject netObject = Net.objects[data.uniqueId];

            if(netObject.netVariables == null)
                netObject.netVariables = new NetVariables();

            Type myObjectType = data.GetType();

            FieldInfo[] myPropertyInfo = typeof(NetVariables).GetFields();
            
            //bool changed = false;
            //for all the fields in NetVariables
            for (int i = 0; i < myPropertyInfo.Length; i++)
            {
                //print(myPropertyInfo[i].ToString());
                //print(myPropertyInfo[i].GetValue(netObject.netVariables));
                var v1 = myPropertyInfo[i].GetValue(data);
                var v2 = myPropertyInfo[i].GetValue(netObject.netVariables);

                
                if (v1 != null && !System.Object.Equals(v1, v2))
                {
                    //set the variable
                    try
                    {
                        myPropertyInfo[i].SetValue(netObject.netVariables, v1);
                    }
                    catch(Exception err)
                    {
                        Debug.LogException(err, this);
                    }
                    
                    netObject.OnVariableChange(myPropertyInfo[i].Name);
                    
                }
            }//iteration
            
        }
    }