From edc8f6e908fecc554aad25b27b26960c2b7a4c01 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 2 Aug 2016 21:37:10 +0800 Subject: [PATCH] [unity] Fix SkeletonDataAssetInspector GUILayout --- .../Asset Types/Editor/SkeletonDataAssetInspector.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs b/spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs index 27d69866d..b1d98e781 100644 --- a/spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs +++ b/spine-unity/Assets/spine-unity/Asset Types/Editor/SkeletonDataAssetInspector.cs @@ -132,7 +132,10 @@ namespace Spine.Unity.Editor { return; } } - + + // Some code depends on the existence of m_skeletonAnimation instance. + // If m_skeletonAnimation is lazy-instantiated elsewhere, this can cause contents to change between Layout and Repaint events, causing GUILayout control count errors. + InitPreview(); if (m_skeletonData != null) { DrawAnimationStateInfo(); DrawAnimationList(); @@ -229,10 +232,6 @@ namespace Spine.Unity.Editor { using (new GUILayout.HorizontalScope()) { if (GUILayout.Button(new GUIContent("Bake All Skins", SpineEditorUtilities.Icons.unityIcon), GUILayout.Height(32), GUILayout.Width(150))) SkeletonBaker.BakeToPrefab(m_skeletonDataAsset, m_skeletonData.Skins, "", bakeAnimations, bakeIK, bakeEventOptions); - - // If m_skeletonAnimation is lazy-instantiated elsewhere, this can cause contents to change between Layout and Repaint events, causing scope errors. - if (m_skeletonData != null && m_skeletonAnimation == null) - InitPreview(); if (m_skeletonAnimation != null && m_skeletonAnimation.skeleton != null) { Skin bakeSkin = m_skeletonAnimation.skeleton.Skin;