Skip to content

Commit

Permalink
Fix issue MixedRealityToolkit#40: ExperimentalDrawer.cs doesn't compi…
Browse files Browse the repository at this point in the history
…le in Unity Editor 2022.3.2f1 (MixedRealityToolkit#430)

* Fix regex in repackaging script (MixedRealityToolkit#427)

The regex for extracting the version number from the package.json file was grabbing the wrong version in some instances.  Fixed.

(cherry picked from commit 20a0728)

* Fix ExperimentalDrawer.cs doesn't compile in Unity Editor 2022.3.2f1 and above. MixedRealityToolkit#40
Use a cached height calculated in OnGUI().
  • Loading branch information
shaynie authored Aug 21, 2023
1 parent c686733 commit 770b1c4
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ namespace MixedReality.Toolkit.Editor
[CustomPropertyDrawer(typeof(ExperimentalAttribute))]
public class ExperimentalDrawer : DecoratorDrawer
{
// Cached height calculated in OnGUI
private float lastHeight = 18;

/// <summary>
/// A function called by Unity to render and handle GUI events.
/// </summary>
Expand All @@ -24,6 +27,7 @@ public override void OnGUI(Rect position)
EditorStyles.helpBox.richText = true;
EditorGUI.HelpBox(position, experimental.Text, MessageType.Warning);
EditorStyles.helpBox.richText = defaultValue;
lastHeight = EditorStyles.helpBox.CalcHeight(new GUIContent(experimental.Text), EditorGUIUtility.currentViewWidth);
}
}

Expand All @@ -35,7 +39,7 @@ public override float GetHeight()
{
if (attribute is ExperimentalAttribute experimental)
{
return EditorStyles.helpBox.CalcHeight(new GUIContent(experimental.Text), EditorGUIUtility.currentViewWidth);
return lastHeight;
}

return base.GetHeight();
Expand Down

0 comments on commit 770b1c4

Please sign in to comment.