Some UX missing

I personally think this course is lacking in a few areas.

Custom Inspectors.
Runtime UI. (I know it is stated to be an Editor course, however it would have been good to include a runtime example)
Binding using SerializedObject.
Binding using SerializedProperties.

The fact it touches just the bare basics is disappointing.

I would have also included some of the following below to give a better UX by the end.

Asset Selection.
Subscribe in OnEnable and Unsubscribe in OnDisable.
Apply the selected asset to the savedTasksObjectField (fires ValueChanged event)

        private void OnEnable()
        {
            Selection.selectionChanged += OnSelectionChanged;
        }

        private void OnSelectionChanged()
        {
            if (Selection.activeObject is TaskListSO taskListSo)
            {
                taskListSO = taskListSo;
                savedTasksObjectField.value = taskListSO;
            }
        }

        private void OnDisable()
        {
            Selection.selectionChanged -= OnSelectionChanged;
        }

Open the TaskListEditor window when a TaskListSO asset has been double clicked.
Apply the selected asset to the savedTasksObjectField (fires ValueChanged event)

        [OnOpenAsset]
        public static bool OnOpenAssetWindow(int instanceId, int line)
        {
            if (EditorUtility.InstanceIDToObject(instanceId) is not TaskListSO taskListSo) 
                return false;
            
            if (HasOpenInstances<TaskListEditor>())
                return false;
            
            var window = GetWindow<TaskListEditor>("Task List");
            window.taskListSO = taskListSo;
            window.savedTasksObjectField.value = taskListSo;
            return true;
        }

Register to the ValueChanged event on the savedTasksObjectField.

            savedTasksObjectField.RegisterValueChangedCallback(SelectedTaskChanged);

Load Tasks whenever the savedTasksObjectField value has been changed.

        private void SelectedTaskChanged(ChangeEvent<Object> evt)
        {
            LoadTasks();
        }

Move taskListScrollView.Clear() to line above the null check.
This will simply clear the tasks from the UI if there is no task selected.

        private void LoadTasks()
        {
            taskListSO = savedTasksObjectField.value as TaskListSO;
            taskListScrollView.Clear();
            if(taskListSO != null)
            {

Thank you for your feedback, it is appreciated!

The course is a very lightweight introduction into UI Elements, and there definitely is far more to the system.

Earlier this year, I was working on a runtime version of the Task editor (I’ve actually written a complete UI in a work in progress game using just the UI Elements). I got sidetracked, and for that, I apologize. I’ll get that back into the tutorial queue.

Privacy & Terms