public static bool hasSyncedFieldChanged(ServerQTObjectComponent serverComponent, FieldInfo fi, object oldValue) { object currentValue = fi.GetValue(serverComponent.component); return((oldValue == null && currentValue != null) || (oldValue != null && oldValue.Equals(currentValue) == false)); }
public void handleSpawn() { if (obj.objectType == BaseQTObject.type.SERVER) { serverComponent = new ServerQTObjectComponent(this); handleServerObjectSpawn(); obj.onOwnerChanged += handleServerOwnerChange; InvokeRepeating("handleServerSync", 0f, ServerSettings.instance.syncRate); } else { clientComponent = new ClientQTObjectComponent(this); handleClientObjectSpawn(); obj.onOwnerChanged += handleClientOwnerChange; } obj.onOwnerChanged += handleOwnerChange; handleObjectSpawn(); }