MixedRealityToolkit / MixedRealityToolkit-Unity

This repository holds the third generation of the Mixed Reality Toolkit for Unity. The latest version of the MRTK can be found here.
BSD 3-Clause "New" or "Revised" License
374 stars 96 forks source link

ExperimentalDrawer.cs doesn't compile in Unity Editor 2022.3.2f1 and above. #40

Closed IssueSyncBot closed 1 year ago

IssueSyncBot commented 1 year ago

Original issue opened by:

@Chris-70 Chris-70


Describe the bug

The current MRTK3 Unity project uses the editor version 2021.3.2f1, upgrading to Unity Editor 2022.3.2f1 causes the ExperimentalDrawer.cs file to fail compilation with the error:

ArgumentException: You can only call GUI functions from inside OnGUI. image

This results in the components of Theme Provider showing as empty in the Inspector. image

When it should be: image

To reproduce

Steps to reproduce the behavior:

  1. Open the CoreUXThemingExample scene in Unity Editor 2022.3.2f1 (or later). I haven't tested the editors between 2021.3.2f1 (working) and 2022.3.2f1 (not working)
  2. Go to 'the Theme Provider under SceneContent' image
  3. Click on 'Theme Provider'
  4. Open the Console window ''
  5. See error
  6. In the Inspector window you'll see Data Source Provider Singleton; Data Source Theme Provider; and Theme Selector all empty. image

Expected behavior

There should be no compile errors and the Inspector window should show all components for the Theme Provider. image

My setup

Target platform

Additional context

Removing the file will fix the compilation error as well as the Inspector window error. The only use for this file is to add the warning message above these components and isn't necessary for the correct operation of the editor.


ISSUE MIGRATION

Issue migrated from: https://github.com/microsoft/MixedRealityToolkit-Unity/issues/11770

IssueSyncBot commented 1 year ago

Original comment by:

@ChrisGuyML ChrisGuyML


Removing the [CustomPropertyDrawer(typeof(ExperimentalAttribute))] from the class will also fix this issue, however the Inspector will not show the warning.

AMollis commented 1 year ago

Fixed