From 6da33e5c883615eb51fe5caa88271e344314e707 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Mon, 5 Sep 2022 15:56:32 +0200 Subject: [PATCH] [unity] Multiple Canvas Renderers warnings: Fixed missing warning icon in SkeletonGraphic Inspector due to element width. Added console log statement when instantiating SkeletonGraphic as well. --- .../Editor/Components/SkeletonGraphicInspector.cs | 2 +- .../Editor/spine-unity/Editor/Utility/Instantiation.cs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs index 8fe4c60bd..06494bab1 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Components/SkeletonGraphicInspector.cs @@ -261,7 +261,7 @@ namespace Spine.Unity.Editor { EditorGUILayout.LabelField(SpineInspectorUtility.TempContent("This mesh uses multiple atlas pages or blend modes.\n" + "You need to enable 'Multiple Canvas Renderers'\n" + "for correct rendering. Consider packing\n" + - "attachments to a single atlas page if possible.", Icons.warning), GUILayout.Height(60), GUILayout.Width(340)); + "attachments to a single atlas page if possible.", Icons.warning), GUILayout.Height(60), GUILayout.Width(380)); } } } diff --git a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs index 06e675785..745ebd604 100644 --- a/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs +++ b/spine-unity/Assets/Spine/Editor/spine-unity/Editor/Utility/Instantiation.cs @@ -160,10 +160,15 @@ namespace Spine.Unity.Editor { newTransform.position = isUI ? data.spawnPoint : RoundVector(data.spawnPoint, 2); if (isUI) { + SkeletonGraphic skeletonGraphic = ((SkeletonGraphic)newSkeletonComponent); if (usedParent != null && usedParent.GetComponent() != null) { - ((SkeletonGraphic)newSkeletonComponent).MatchRectTransformWithBounds(); + skeletonGraphic.MatchRectTransformWithBounds(); } else Debug.Log("Created a UI Skeleton GameObject not under a RectTransform. It may not be visible until you parent it to a canvas."); + if (skeletonGraphic.HasMultipleSubmeshInstructions() && !skeletonGraphic.allowMultipleCanvasRenderers) + Debug.Log("This mesh uses multiple atlas pages or blend modes. " + + "You need to enable 'Multiple Canvas Renderers for correct rendering. " + + "Consider packing attachments to a single atlas page if possible.", skeletonGraphic); } if (!isUI && usedParent != null && usedParent.transform.localScale != Vector3.one)