InfoBox is drawn disabled when on a field that also has the ReadOnly attribute

Issue #479 resolved
Michael Ryan created an issue

I applied an [InfoBox] attribute to a field that also has a [ReadOnly] attribute.

The InfoBox appears disabled in the Inspector. This seems like a bug. The InfoBox is not interactable, and I believe it makes little sense to draw it disabled.

In my case, the MonoBehaviour had just a couple fields and they were both read-only. As a workaround, I created a simple wrapper class that contains the read-only fields, so the InfoBox attribute could be placed on the wrapper class and the ReadOnly attributes remained on the fields inside the wrapper class. This seems like the best solution for now, but I'm not crazy about using this extra class in the MonoBehaviour just to control its appearance in the Inspector.

If the InfoBoxAttributeDrawer cannot be updated to always force "GUI.enabled = true" before the message box is drawn and reset it afterward (before drawing the next control), could we get an optional flag property added to InfoBoxAttribute to force it enabled manually?

I'm using Unity 2018.3.0 on Windows 10 with Odin 2.0.13. Editor Only mode is enabled.

Comments (1)

  1. mSkull001

    Thanks for the report. I've added a GUIAlwaysEnabled option to the InfoBox attribute now, so you can override this behaviour now.

  2. Log in to comment