From 24d41850167407c5794800bf003a6e4f8f6166ba Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Sun, 20 Oct 2019 18:43:15 +0200 Subject: [PATCH] [unity] Fixed compile error on Unity 2018.3+. --- .../Editor/spine-unity/Editor/Utility/Preferences.cs | 4 ++-- .../spine-unity/Editor/Windows/SpinePreferences.cs | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs index d8f90e195..ef8db192e 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Preferences.cs @@ -176,7 +176,7 @@ namespace Spine.Unity.Editor { newPreferences.atlasTxtImportWarning = EditorPrefs.GetBool(ATLASTXT_WARNING_KEY, SpinePreferences.DEFAULT_ATLASTXT_WARNING); newPreferences.textureImporterWarning = EditorPrefs.GetBool(TEXTUREIMPORTER_WARNING_KEY, SpinePreferences.DEFAULT_TEXTUREIMPORTER_WARNING); newPreferences.timelineUseBlendDuration = EditorPrefs.GetBool(TIMELINE_USE_BLEND_DURATION_KEY, SpinePreferences.DEFAULT_TIMELINE_USE_BLEND_DURATION); - newPreferences.handleScale = EditorPrefs.GetBool(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE); + newPreferences.handleScale = EditorPrefs.GetFloat(SCENE_ICONS_SCALE_KEY, SpinePreferences.DEFAULT_SCENE_ICONS_SCALE); } public static void SaveToEditorPrefs(SpinePreferences preferences) { @@ -191,7 +191,7 @@ namespace Spine.Unity.Editor { EditorPrefs.SetBool(ATLASTXT_WARNING_KEY, preferences.atlasTxtImportWarning); EditorPrefs.SetBool(TEXTUREIMPORTER_WARNING_KEY, preferences.textureImporterWarning); EditorPrefs.SetBool(TIMELINE_USE_BLEND_DURATION_KEY, preferences.timelineUseBlendDuration); - EditorPrefs.SetBool(SCENE_ICONS_SCALE_KEY, preferences.handleScale); + EditorPrefs.SetFloat(SCENE_ICONS_SCALE_KEY, preferences.handleScale); } #endif diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs index 32acff2a5..477b5195b 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Windows/SpinePreferences.cs @@ -86,8 +86,10 @@ namespace Spine.Unity.Editor { public const bool DEFAULT_AUTO_RELOAD_SCENESKELETONS = true; public bool autoReloadSceneSkeletons = DEFAULT_AUTO_RELOAD_SCENESKELETONS; + public const string SCENE_ICONS_SCALE_KEY = "SPINE_SCENE_ICONS_SCALE"; internal const float DEFAULT_SCENE_ICONS_SCALE = 1f; - public static float handleScale = DEFAULT_SCENE_ICONS_SCALE; + [Range(0.01f, 2f)] + public float handleScale = DEFAULT_SCENE_ICONS_SCALE; public const bool DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME = true; public bool mecanimEventIncludeFolderName = DEFAULT_MECANIM_EVENT_INCLUDE_FOLDERNAME; @@ -95,7 +97,7 @@ namespace Spine.Unity.Editor { // Timeline extension module public const bool DEFAULT_TIMELINE_USE_BLEND_DURATION = true; public bool timelineUseBlendDuration = DEFAULT_TIMELINE_USE_BLEND_DURATION; - + #if NEW_PREFERENCES_SETTINGS_PROVIDER public static void Load () { GetOrCreateSettings(); @@ -171,10 +173,10 @@ namespace Spine.Unity.Editor { EditorGUILayout.LabelField("Handles and Gizmos", EditorStyles.boldLabel); { EditorGUI.BeginChangeCheck(); - handleScale = EditorGUILayout.Slider("Editor Bone Scale", handleScale, 0.01f, 2f); - handleScale = Mathf.Max(0.01f, handleScale); + var scaleProperty = settings.FindProperty("handleScale"); + EditorGUILayout.PropertyField(scaleProperty, new GUIContent("Editor Bone Scale")); if (EditorGUI.EndChangeCheck()) { - EditorPrefs.SetFloat(SpinePreferences.SCENE_ICONS_SCALE_KEY, handleScale); + EditorPrefs.SetFloat(SpinePreferences.SCENE_ICONS_SCALE_KEY, scaleProperty.floatValue); SceneView.RepaintAll(); } }