public override void OnInspectorGUI() { serializedObject.Update(); /*GUI.enabled = emitter.Initialized; * EditorGUI.BeginChangeCheck(); * editMode = GUILayout.Toggle(editMode,new GUIContent("Edit particles",EditorGUIUtility.Load("Obi/EditParticles.psd") as Texture2D),"LargeButton"); * if (EditorGUI.EndChangeCheck()){ * SceneView.RepaintAll(); * } * GUI.enabled = true;*/ EditorGUILayout.HelpBox("Active particles:" + emitter.ActiveParticles, MessageType.Info); EditorGUI.BeginChangeCheck(); ObiSolver solver = EditorGUILayout.ObjectField("Solver", emitter.Solver, typeof(ObiSolver), true) as ObiSolver; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(emitter, "Set solver"); emitter.Solver = solver; } EditorGUI.BeginChangeCheck(); ObiCollisionMaterial material = EditorGUILayout.ObjectField("Collision Material", emitter.CollisionMaterial, typeof(ObiCollisionMaterial), false) as ObiCollisionMaterial; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(emitter, "Set collision material"); emitter.CollisionMaterial = material; } EditorGUI.BeginChangeCheck(); ObiEmitterMaterial emitterMaterial = EditorGUILayout.ObjectField(new GUIContent("Emitter Material", "Emitter material used. This controls the behavior of the emitted particles."), emitter.EmitterMaterial, typeof(ObiEmitterMaterial), false) as ObiEmitterMaterial; if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(emitter, "Set emitter material"); emitter.EmitterMaterial = emitterMaterial; } EditorGUI.BeginChangeCheck(); int numParticles = EditorGUILayout.IntField(new GUIContent("Num particles", "Amount of pooled particles used by this emitter."), emitter.NumParticles); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(emitter, "Set num particles"); emitter.NumParticles = numParticles; } Editor.DrawPropertiesExcluding(serializedObject, "m_Script"); // Apply changes to the serializedProperty if (GUI.changed) { emitter.UpdateParticlePhases(); //TODO: only do this when changing material. serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { serializedObject.Update(); emitter.Solver = EditorGUILayout.ObjectField("Solver", emitter.Solver, typeof(ObiSolver), true) as ObiSolver; emitter.EmitterMaterial = EditorGUILayout.ObjectField(new GUIContent("Emitter material", "Emitter material used. This controls the behavior of the emitted particles."), emitter.EmitterMaterial, typeof(ObiEmitterMaterial), false) as ObiEmitterMaterial; emitter.NumParticles = EditorGUILayout.IntField(new GUIContent("Num particles", "Amount of pooled particles used by this emitter."), emitter.NumParticles); Editor.DrawPropertiesExcluding(serializedObject, "m_Script"); // Apply changes to the serializedProperty if (GUI.changed) { emitter.UpdateParticlePhases(); //TODO: only do this when changing material. serializedObject.ApplyModifiedProperties(); } }
public override void OnInspectorGUI() { serializedObject.Update(); /*GUI.enabled = emitter.Initialized; * EditorGUI.BeginChangeCheck(); * editMode = GUILayout.Toggle(editMode,new GUIContent("Edit particles",EditorGUIUtility.Load("Obi/EditParticles.psd") as Texture2D),"LargeButton"); * if (EditorGUI.EndChangeCheck()){ * SceneView.RepaintAll(); * } * GUI.enabled = true;*/ EditorGUILayout.HelpBox("Active particles:" + emitter.ActiveParticles, MessageType.Info); Editor.DrawPropertiesExcluding(serializedObject, "m_Script"); // Apply changes to the serializedProperty if (GUI.changed) { emitter.UpdateParticlePhases(); //TODO: only do this when changing material. serializedObject.ApplyModifiedProperties(); } }