Skip to content

Commit 90eafaa

Browse files
authored
Don't bother with method restoration, just use raw GLOpt (#115)
1 parent f341dc1 commit 90eafaa

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

RuntimeUnityEditor.Core/Utils/Abstractions/GUILayoutShim.cs

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,42 @@ public static class GUILayoutShim
77
public static GUILayoutOption MaxWidth(float width)
88
{
99
#if IL2CPP
10-
var entity = GUILayout.ExpandHeight(true);
11-
entity.type = GUILayoutOption.Type.maxWidth;
12-
entity.value = width;
10+
var entity = new UnityEngine.GUILayoutOption(GUILayoutOption.Type.maxWidth, width);
1311
return entity;
1412
#else
1513
return GUILayout.MaxWidth(width);
1614
#endif
1715
}
1816

17+
public static GUILayoutOption ExpandWidth(bool expand)
18+
{
19+
#if IL2CPP
20+
var entity = new UnityEngine.GUILayoutOption(GUILayoutOption.Type.stretchWidth, expand);
21+
return entity;
22+
#else
23+
return GUILayout.ExpandWidth(expand);
24+
#endif
25+
}
26+
27+
public static GUILayoutOption ExpandHeight(bool expand)
28+
{
29+
#if IL2CPP
30+
var entity = new UnityEngine.GUILayoutOption(GUILayoutOption.Type.stretchHeight, expand);
31+
return entity;
32+
#else
33+
return GUILayout.ExpandHeight(expand);
34+
#endif
35+
}
36+
37+
1938
public static GUILayoutOption MinWidth(float width)
2039
{
2140
#if IL2CPP
22-
var entity = GUILayout.ExpandHeight(true);
23-
entity.type = GUILayoutOption.Type.minWidth;
24-
entity.value = width;
41+
var entity = new UnityEngine.GUILayoutOption(GUILayoutOption.Type.minWidth, width);
2542
return entity;
2643
#else
2744
return GUILayout.MinWidth(width);
2845
#endif
2946
}
3047
}
31-
}
48+
}

0 commit comments

Comments
 (0)