Skip to content

Commit 69bc4ce

Browse files
authored
Cherry pick #430 to release/3.0.0 (#431)
* Fix ExperimentalDrawer.cs doesn't compile in Unity Editor 2022.3.2f1 and above. #40 Use a cached height calculated in OnGUI(). (cherry picked from commit 770b1c4)
2 parents 20a0728 + e6d2b06 commit 69bc4ce

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

org.mixedrealitytoolkit.core/Editor/PropertyDrawers/ExperimentalDrawer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ namespace MixedReality.Toolkit.Editor
1212
[CustomPropertyDrawer(typeof(ExperimentalAttribute))]
1313
public class ExperimentalDrawer : DecoratorDrawer
1414
{
15+
// Cached height calculated in OnGUI
16+
private float lastHeight = 18;
17+
1518
/// <summary>
1619
/// A function called by Unity to render and handle GUI events.
1720
/// </summary>
@@ -24,6 +27,7 @@ public override void OnGUI(Rect position)
2427
EditorStyles.helpBox.richText = true;
2528
EditorGUI.HelpBox(position, experimental.Text, MessageType.Warning);
2629
EditorStyles.helpBox.richText = defaultValue;
30+
lastHeight = EditorStyles.helpBox.CalcHeight(new GUIContent(experimental.Text), EditorGUIUtility.currentViewWidth);
2731
}
2832
}
2933

@@ -35,7 +39,7 @@ public override float GetHeight()
3539
{
3640
if (attribute is ExperimentalAttribute experimental)
3741
{
38-
return EditorStyles.helpBox.CalcHeight(new GUIContent(experimental.Text), EditorGUIUtility.currentViewWidth);
42+
return lastHeight;
3943
}
4044

4145
return base.GetHeight();

0 commit comments

Comments
 (0)