diff --git a/Editor/Scripts/Drawers/GraphSystemGroupDataDrawer.cs b/Editor/Scripts/Drawers/GraphSystemGroupDataDrawer.cs index a1029f6..37fef48 100644 --- a/Editor/Scripts/Drawers/GraphSystemGroupDataDrawer.cs +++ b/Editor/Scripts/Drawers/GraphSystemGroupDataDrawer.cs @@ -1,29 +1,41 @@ using Software10101.DOTS.Editor.GraphEditor; using Software10101.DOTS.MonoBehaviours; using UnityEditor; +using UnityEngine; using UnityEngine.UIElements; namespace Software10101.DOTS.Editor.Drawers { [CustomPropertyDrawer(typeof(WorldBehaviour.GraphSystemGroupData))] public class GraphSystemGroupDataDrawer : PropertyDrawer { public override VisualElement CreatePropertyGUI(SerializedProperty property) { - // Create property container element. VisualElement container = new(); - // Create property fields. Button editButton = new(() => { - GraphSystemGroupEditorWindow window = EditorWindow.GetWindow(); - - WorldBehaviour wb = (WorldBehaviour)property.serializedObject.targetObject; - window.Initialize(wb, property.name); + OpenGraph(property); }) { text = $"Edit {property.displayName}" }; - // Add fields to the container. container.Add(editButton); return container; } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { + EditorGUI.BeginProperty(position, label, property); + + if (GUILayout.Button($"Edit {property.displayName}")) { + OpenGraph(property); + } + + EditorGUI.EndProperty(); + } + + private static void OpenGraph(SerializedProperty property) { + GraphSystemGroupEditorWindow window = EditorWindow.GetWindow(); + + WorldBehaviour wb = (WorldBehaviour)property.serializedObject.targetObject; + window.Initialize(wb, property.name); + } } } diff --git a/Runtime/Scripts/MonoBehaviours/WorldBehaviour.cs b/Runtime/Scripts/MonoBehaviours/WorldBehaviour.cs index e72d1c2..22d7937 100644 --- a/Runtime/Scripts/MonoBehaviours/WorldBehaviour.cs +++ b/Runtime/Scripts/MonoBehaviours/WorldBehaviour.cs @@ -22,7 +22,7 @@ public sealed class WorldBehaviour : MonoBehaviour { public EntityManager EntityManager => _world.EntityManager; [SerializeField] - private WorldFlags _flags = WorldFlags.Live | WorldFlags.Game; + private WorldFlags _flags = WorldFlags.Game; [SerializeField] private GraphSystemGroupData _simResetGroup = GraphSystemGroupData.CreateEmpty(); diff --git a/package.json b/package.json index aca87c1..d1f944e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.10101software.dots.hybridsimulation", "displayName": "DOTS Hybrid Simulation Worlds", "description": "A framework for using FixedUpdate in a simulation world which is linked to a GameObject-based presentation layer.", - "version": "1.0.0", + "version": "1.0.1", "unity": "2022.3", "dependencies": { "com.unity.entities": "1.0.11"