private void AddGrassPhysicsCamera() { GrassPhysicsCamera physicsCamera = myTarget.gameObject.AddComponent <GrassPhysicsCamera>(); physicsCamera.physicsArea = myTarget; physicsCamera.Cam.cullingMask = 1; myTarget.AddOnSetDepthTextureEvent(physicsCamera.RenderTexture); UnityEditorInternal.ComponentUtility.MoveComponentUp(physicsCamera.Cam); UnityEditorInternal.ComponentUtility.MoveComponentUp(physicsCamera); }
public override void OnInspectorGUI() { serializedObject.Update(); myTarget = target as GrassPhysicsCamera; Undo.RecordObject(myTarget, "Update in " + myTarget.name); Undo.RecordObject(myTarget.Cam, "Update in " + myTarget.Cam.name); EditorGUI.BeginChangeCheck(); ShowGUI(); if (EditorGUI.EndChangeCheck()) { EditorUtility.SetDirty(myTarget); EditorUtility.SetDirty(myTarget.Cam); } serializedObject.ApplyModifiedProperties(); }