protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.center)); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.height)); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((CapsuleCollider x) => x.direction)); }
protected void Record() { if (m_enableUndo) { RuntimeUndo.RecordValue(Target, MemberInfo); } }
protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_source, Strong.PropertyInfo((AudioReverbZone x) => x.minDistance)); RuntimeUndo.RecordValue(m_source, Strong.PropertyInfo((AudioReverbZone x) => x.maxDistance)); }
protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((SphereCollider x) => x.center)); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((SphereCollider x) => x.radius)); }
public void CompleteSpawn() { if (RuntimeEditorApplication.IsPointerOverWindow(RuntimeWindowType.SceneView)) { if (m_resource is Material) { Material material = (Material)m_resource; Camera sceneCamera = RuntimeEditorApplication.ActiveSceneCamera; if (sceneCamera) { Ray ray = sceneCamera.ScreenPointToRay(Input.mousePosition); RaycastHit hitInfo; if (Physics.Raycast(ray, out hitInfo)) { MeshRenderer renderer = hitInfo.collider.GetComponentInChildren <MeshRenderer>(); SkinnedMeshRenderer sRenderer = hitInfo.collider.GetComponentInChildren <SkinnedMeshRenderer>(); if (renderer != null || sRenderer != null) { RuntimeUndo.BeginRecord(); } if (renderer != null) { RuntimeUndo.RecordValue(renderer, Strong.PropertyInfo((MeshRenderer x) => x.sharedMaterials)); Material[] materials = renderer.sharedMaterials; for (int i = 0; i < materials.Length; ++i) { materials[i] = material; } renderer.sharedMaterials = materials; } if (sRenderer != null) { RuntimeUndo.RecordValue(sRenderer, Strong.PropertyInfo((SkinnedMeshRenderer x) => x.sharedMaterials)); Material[] materials = sRenderer.sharedMaterials; for (int i = 0; i < materials.Length; ++i) { materials[i] = material; } sRenderer.sharedMaterials = materials; } if (renderer != null || sRenderer != null) { RuntimeUndo.EndRecord(); } if (renderer != null || sRenderer != null) { RuntimeUndo.BeginRecord(); } if (renderer != null) { RuntimeUndo.RecordValue(renderer, Strong.PropertyInfo((MeshRenderer x) => x.sharedMaterials)); } if (sRenderer != null) { RuntimeUndo.RecordValue(sRenderer, Strong.PropertyInfo((SkinnedMeshRenderer x) => x.sharedMaterials)); } if (renderer != null || sRenderer != null) { RuntimeUndo.EndRecord(); } } } } else { if (m_state == State.AfterSpawn) { bool isEnabled = RuntimeUndo.Enabled; RuntimeUndo.Enabled = false; RuntimeSelection.objects = m_selection; RuntimeUndo.Enabled = isEnabled; RuntimeUndo.BeginRecord(); RuntimeUndo.RecordSelection(); RuntimeUndo.BeginRegisterCreateObject(m_instance); RuntimeUndo.EndRecord(); RuntimeUndo.Enabled = false; RuntimeSelection.activeGameObject = m_instance; RuntimeUndo.Enabled = isEnabled; RuntimeUndo.BeginRecord(); RuntimeUndo.RegisterCreatedObject(m_instance); RuntimeUndo.RecordSelection(); RuntimeUndo.EndRecord(); } } EndSpawn(); RuntimeEditorApplication.ActivateWindow(RuntimeWindowType.SceneView); } else { if (!RuntimeEditorApplication.IsPointerOverWindow(RuntimeWindowType.Hierarchy)) { EndSpawn(); } } }
protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_light, Strong.PropertyInfo((Light x) => x.range)); RuntimeUndo.RecordValue(m_light, Strong.PropertyInfo((Light x) => x.spotAngle)); }
private void OnResetClick() { RuntimeUndo.BeginRecord(); GameObject go = new GameObject(); go.SetActive(false); Component component = go.GetComponent(Component.GetType()); if (component == null) { component = go.AddComponent(Component.GetType()); } bool isMonoBehavior = component is MonoBehaviour; PropertyDescriptor[] descriptors = GetDescriptors(m_converter); for (int i = 0; i < descriptors.Length; ++i) { PropertyDescriptor descriptor = descriptors[i]; MemberInfo memberInfo = descriptor.ComponentMemberInfo; if (memberInfo is PropertyInfo) { PropertyInfo p = (PropertyInfo)memberInfo; object defaultValue = p.GetValue(component, null); RuntimeUndo.RecordValue(Component, memberInfo); p.SetValue(Component, defaultValue, null); } else { if (isMonoBehavior) { if (memberInfo is FieldInfo) { FieldInfo f = (FieldInfo)memberInfo; object defaultValue = f.GetValue(component); RuntimeUndo.RecordValue(Component, memberInfo); f.SetValue(Component, defaultValue); } } } } for (int i = 0; i < descriptors.Length; ++i) { PropertyDescriptor descriptor = descriptors[i]; MemberInfo memberInfo = descriptor.MemberInfo; PropertyEditor propertyEditor = GetPropertyEditor(memberInfo); if (propertyEditor != null) { propertyEditor.Reload(); } } Destroy(go); RuntimeUndo.EndRecord(); RuntimeUndo.BeginRecord(); for (int i = 0; i < descriptors.Length; ++i) { PropertyDescriptor descriptor = descriptors[i]; MemberInfo memberInfo = descriptor.ComponentMemberInfo; if (memberInfo is PropertyInfo) { RuntimeUndo.RecordValue(Component, memberInfo); } else { if (isMonoBehavior) { RuntimeUndo.RecordValue(Component, memberInfo); } } } RuntimeUndo.EndRecord(); }
protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((BoxCollider x) => x.center)); RuntimeUndo.RecordValue(m_collider, Strong.PropertyInfo((BoxCollider x) => x.size)); }
protected override void RecordOverride() { base.RecordOverride(); RuntimeUndo.RecordValue(m_skinnedMeshRenderer, Strong.PropertyInfo((SkinnedMeshRenderer x) => x.localBounds)); }