private void OnUpdateComponentProperties(rdtTcpMessage message) { rdtDebug.Debug(this, "OnUpdateComponentProperties", new object[0]); rdtTcpMessageUpdateComponentProperties properties = (rdtTcpMessageUpdateComponentProperties)message; GameObject gob = this.FindGameObject(properties.m_gameObjectInstanceId); if (gob != null) { UnityEngine.Component owner = this.FindComponent(gob, properties.m_componentInstanceId); if (owner == null) { rdtDebug.Error(this, "Tried to update component with id {0} (name={1}) but couldn't find it!", new object[] { properties.m_componentInstanceId, properties.m_componentName }); } else { if (owner is Behaviour) { ((Behaviour)owner).enabled = properties.m_enabled; } else if (owner is Renderer) { ((Renderer)owner).enabled = properties.m_enabled; } else if (owner is Collider) { ((Collider)owner).enabled = properties.m_enabled; } if (properties.m_properties != null) { this.m_server.SerializerRegistry.WriteAllFields(owner, properties.m_properties); } } } }
private void OnPropertyChanged(rdtTcpMessageComponents.Component?component, [Optional, DefaultParameterValue(null)] Stack <rdtTcpMessageComponents.Property> hierarchy, [Optional, DefaultParameterValue(null)] UnityEngine.Component unityComponent) { if ((this.m_client != null) && component.HasValue) { rdtTcpMessageUpdateComponentProperties message = new rdtTcpMessageUpdateComponentProperties(); message.m_gameObjectInstanceId = this.m_selected.Value.m_instanceId; message.m_componentName = component.Value.m_name; message.m_componentInstanceId = component.Value.m_instanceId; message.m_enabled = component.Value.m_enabled; if ((hierarchy != null) && (hierarchy.Count > 0)) { message.m_properties = this.CloneAndSerialize(hierarchy); } this.m_client.EnqueueMessage(message); } }