MixedRealityToolkit-Unity icon indicating copy to clipboard operation
MixedRealityToolkit-Unity copied to clipboard

Nested Prefabs work poorly with MRTK custom inspectors

Open wiwei opened this issue 7 years ago • 4 comments

The new Nested Prefabs have extensive inspector functionality to allow you to apply selective updates to prefabs. If working directly in a scene on prefabs, you can apply changes piecemeal to the prefabs.

However the custom inspector is nonfunctional or just decently frustrating to work with when using prefabs:

Examples: The blue line on the left here indicates that there is a pending change that can be applied. Normally in the inspector you can right click and individually apply changes. For Unity Events the hitbox is small to nonexistent. I have succeeded occasionally, but I need to apply ~20 changes and it takes 4-12 attempts to hit the TINY hitbox for applying the change. This particular problem could be an issue with out-of-the-box UnityEvents, I haven't looked into whether that is the case.

19b9591f-7992-42b4-9367-28c14a879fe2 441c9683-09bd-498e-a3c2-fd48d17d76b5

Some fields do not even indicate that there are pending changes. See the following two images for an example: 786fd616-d8b3-480a-b7da-e48251571d02

The first one has the pending change. This is a straight hostile nonfunctionality that will create significant interaction errors. c6cbf497-9399-41bd-b14d-648b5aa9b959

Finally, many fields don't even actively display and allow you to apply those prefab changes. If you put the Inspector in Debug Mode, you can see the extent of changes (this is from our custom inspectors which have 0 blue fields unapplied)

The pervasiveness to which this is a problem heavily encourages a developer to never use the inspector in scene, or to constantly switch to debug inspectors to check to make sure they understand the state of their objects (which is a severe problem)

This is likely a widespread issue across ALL custom inspectors and we need a solid solution for our developers.f their objects (which is a severe problem)

f3b0b5e7-7363-44f4-a302-e3f2a027c7c8

This is likely a widespread issue across ALL custom inspectors and we need a solid solution for our developers.

f98d0d3b-7017-44eb-98c3-adc39cd02f22

wiwei avatar May 15 '19 17:05 wiwei

Ported to Github, reference 20124104

wiwei avatar May 15 '19 17:05 wiwei

This is likely a widespread issue across ALL custom inspectors and we need a solid solution for our developers.f their objects (which is a severe problem)

Agreed, and I think we may need some guidance from Unity here as well.

In the past, these rules of thumb have been an adequate safeguard against breaking prefab overrides:

  • It's bad practice for a custom inspector to modify fields and properties directly. Always modify serialized properties.
  • Use EditorGUILayout.PropertyField unless absolutely necessary.
  • If using custom property drawers, make correct use of serializedProperty.isInstantiatedPrefab.

As far as I can tell @killerantz followed all of these rules in his Interactable inspector. So there must be more to the story with nested prefabs.

Railboy avatar May 15 '19 21:05 Railboy

I'll try to take a look today and report back if there's anything we need to update globally or just a bug in Interactable inspectors.

killerantz avatar May 16 '19 18:05 killerantz

I looked at the Inspector and on some of the fields I did not use the EditorGUILayout.PropertyField which will automatically provide the bolding and the blue mark when an update is pending. I was planning to do an update in the next couple days if this isn't a priority.

killerantz avatar May 21 '19 00:05 killerantz