Skip to content

Commit 3bb7e05

Browse files
committed
Visibility toggle fix for 2018.3
Implemented fix for 2018.3, provided by James Park.
1 parent b07a4bd commit 3bb7e05

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

Editor/QuickToggle.cs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,27 @@ private static void BuildStyles()
447447

448448
// Unselected just makes the normal states have no lock images
449449
tempStyle = GUI.skin.FindStyle("OL Toggle");
450-
styleUnlocked = new GUIStyle(tempStyle);
451-
452-
tempStyle = GUI.skin.FindStyle("VisibilityToggle");
453-
454-
styleVisOff = new GUIStyle(tempStyle);
450+
styleUnlocked = new GUIStyle(tempStyle);
451+
#if UNITY_2018_3_OR_NEWER
452+
tempStyle = new GUIStyle()
453+
{
454+
normal = new GUIStyleState() { background = EditorGUIUtility.Load("Icons/animationvisibilitytoggleoff.png") as Texture2D },
455+
onNormal = new GUIStyleState() { background = EditorGUIUtility.Load("Icons/animationvisibilitytoggleon.png") as Texture2D },
456+
fixedHeight = 11,
457+
fixedWidth = 13,
458+
border = new RectOffset(2, 2, 2, 2),
459+
overflow = new RectOffset(-1, 1, -2, 2),
460+
padding = new RectOffset(3, 3, 3, 3),
461+
richText = false,
462+
stretchHeight = false,
463+
stretchWidth = false,
464+
};
465+
#else
466+
tempStyle = GUI.skin.FindStyle("VisibilityToggle");
467+
#endif
468+
469+
470+
styleVisOff = new GUIStyle(tempStyle);
455471
styleVisOn = new GUIStyle(tempStyle)
456472
{
457473
normal = new GUIStyleState() { background = tempStyle.onNormal.background }

0 commit comments

Comments
 (0)