Mixedrealitytoolkit-unity: Interactable inspector does not let user set Toggle/MultiDimensional button type

Created on 2 Oct 2019  路  3Comments  路  Source: microsoft/MixedRealityToolkit-Unity

To reproduce

Steps to reproduce the behavior:

  1. Add an interactable script to your gameobject.
  2. Try setting SelectionMode to Toggle
  3. Nothing happens. User is unable to update the selection mode.

Notice the following exception in editor logs:

NullReferenceException: Start Dimension Index: SerializedProperty is null
UnityEditor.EditorGUI.BeginPropertyInternal (UnityEngine.Rect totalPosition, UnityEngine.GUIContent label, UnityEditor.SerializedProperty property) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:5471)
UnityEditor.EditorGUI.BeginProperty (UnityEngine.Rect totalPosition, UnityEngine.GUIContent label, UnityEditor.SerializedProperty property) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:5446)
UnityEditor.EditorGUI+PropertyScope..ctor (UnityEngine.Rect totalPosition, UnityEngine.GUIContent label, UnityEditor.SerializedProperty property) (at C:/buildslave/unity/build/Editor/Mono/EditorGUI.cs:5434)
Microsoft.MixedReality.Toolkit.UI.Editor.InteractableInspector.RenderGeneralSettings () (at Assets/MixedRealityToolkit.SDK/Inspectors/UX/Interactable/InteractableInspector.cs:360)

Repros on mrtk_dev and probably on stabilization 2.1 branch.

Bug Release Blocker

Most helpful comment

@Troy-Ferrell , @julenka this feels like a blocking issue. I believe it is a side effect of https://github.com/microsoft/MixedRealityToolkit-Unity/pull/6104

I have a fix for this. Should I target it to stabilization ?

All 3 comments

@Troy-Ferrell , @julenka this feels like a blocking issue. I believe it is a side effect of https://github.com/microsoft/MixedRealityToolkit-Unity/pull/6104

I have a fix for this. Should I target it to stabilization ?

Yes please!

I've tried to think of a good way to prevent these kinds of regressions. The root problem is that you can't directly reference a private field; not even for a nameof(SomeClass.privateField).

On one project, to solve this problem and get auto rename fixes, I exposed public static properties that returned the nameof for each private serialized field. Not sure it's a great pattern because it's a bit much to maintain.

Another alternative is to have the inspector be a nested class of the thing that it inspects. This lets you use nameof() for privates. I think MRTK used to have some inspectors that were implemented this way. I assume there were some issues with doing it that way. If nothing else, it's a non-standard practice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nuernber picture nuernber  路  3Comments

nrchuanqi picture nrchuanqi  路  3Comments

markgrossnickle picture markgrossnickle  路  3Comments

brean picture brean  路  3Comments

amfdeluca picture amfdeluca  路  3Comments