diff --git a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs index 369682ca7f..b0c0f26fec 100644 --- a/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs +++ b/spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs @@ -73,6 +73,17 @@ public class SkeletonRenderTexture : SkeletonRenderTextureBase { CreateQuadChild(); } +#if UNITY_EDITOR + protected void Reset () { + string[] folders = { "Assets", "Packages" }; + string[] assets = UnityEditor.AssetDatabase.FindAssets("t:material RenderQuadMaterial", folders); + if (assets.Length > 0) { + string materialPath = UnityEditor.AssetDatabase.GUIDToAssetPath(assets[0]); + quadMaterial = UnityEditor.AssetDatabase.LoadAssetAtPath(materialPath); + } + } +#endif + void CreateQuadChild () { quad = new GameObject(this.name + " RenderTexture", typeof(MeshRenderer), typeof(MeshFilter)); quad.transform.SetParent(this.transform.parent, false); diff --git a/spine-unity/Assets/Spine Examples/package.json b/spine-unity/Assets/Spine Examples/package.json index 08f694f004..2fd21dc344 100644 --- a/spine-unity/Assets/Spine Examples/package.json +++ b/spine-unity/Assets/Spine Examples/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity-examples", "displayName": "spine-unity Runtime Examples", "description": "This plugin provides example scenes and scripts for the spine-unity runtime.", - "version": "4.1.12", + "version": "4.1.13", "unity": "2018.3", "author": { "name": "Esoteric Software", diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Internal/SkeletonSubmeshGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Internal/SkeletonSubmeshGraphic.cs index 6bd62bae5a..3bab4839b8 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Internal/SkeletonSubmeshGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/Internal/SkeletonSubmeshGraphic.cs @@ -43,5 +43,15 @@ public class SkeletonSubmeshGraphic : MaskableGraphic { protected override void OnPopulateMesh (VertexHelper vh) { vh.Clear(); } + + protected override void OnDisable () { + base.OnDisable(); + this.canvasRenderer.cull = true; + } + + protected override void OnEnable () { + base.OnEnable(); + this.canvasRenderer.cull = false; + } } } diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 7e060a6747..55a801270e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -588,6 +588,13 @@ public enum LayoutMode { SetRectTransformSize(this, size); this.rectTransform.pivot = p; + foreach (Transform separatorPart in separatorParts) { + RectTransform separatorTransform = separatorPart.GetComponent(); + if (separatorTransform) { + SetRectTransformSize(separatorTransform, size); + separatorTransform.pivot = p; + } + } foreach (SkeletonSubmeshGraphic submeshGraphic in submeshGraphics) { SetRectTransformSize(submeshGraphic, size); submeshGraphic.rectTransform.pivot = p; @@ -595,14 +602,18 @@ public enum LayoutMode { } public static void SetRectTransformSize (Graphic target, Vector2 size) { + SetRectTransformSize(target.rectTransform, size); + } + + public static void SetRectTransformSize (RectTransform targetRectTransform, Vector2 size) { Vector2 parentSize = Vector2.zero; - if (target.rectTransform.parent != null) { - RectTransform parentTransform = target.rectTransform.parent.GetComponent(); + if (targetRectTransform.parent != null) { + RectTransform parentTransform = targetRectTransform.parent.GetComponent(); if (parentTransform) parentSize = parentTransform.rect.size; } - Vector2 anchorAreaSize = Vector2.Scale(target.rectTransform.anchorMax - target.rectTransform.anchorMin, parentSize); - target.rectTransform.sizeDelta = size - anchorAreaSize; + Vector2 anchorAreaSize = Vector2.Scale(targetRectTransform.anchorMax - targetRectTransform.anchorMin, parentSize); + targetRectTransform.sizeDelta = size - anchorAreaSize; } /// OnAnimationRebuild is raised after the SkeletonAnimation component is successfully initialized. @@ -970,7 +981,7 @@ public enum LayoutMode { if (i >= usedRenderersCount) canvasRenderer.gameObject.SetActive(true); - if (canvasRenderer.transform.parent != parent.transform) + if (canvasRenderer.transform.parent != parent.transform && !isInRebuild) canvasRenderer.transform.SetParent(parent.transform, false); canvasRenderer.transform.SetSiblingIndex(targetSiblingIndex++); @@ -1007,6 +1018,7 @@ public enum LayoutMode { for (int i = canvasRenderers.Count - 1; i >= 0; --i) { if (canvasRenderers[i] == null) { canvasRenderers.RemoveAt(i); + submeshGraphics.RemoveAt(i); } } } @@ -1074,7 +1086,14 @@ public enum LayoutMode { for (int i = currentCount; i < targetCount; ++i) { GameObject go = new GameObject(string.Format("{0}[{1}]", SeparatorPartGameObjectName, i), typeof(RectTransform)); go.transform.SetParent(this.transform, false); - go.transform.localPosition = Vector3.zero; + + RectTransform dstTransform = go.transform.GetComponent(); + dstTransform.localPosition = Vector3.zero; + dstTransform.pivot = rectTransform.pivot; + dstTransform.anchorMin = Vector2.zero; + dstTransform.anchorMax = Vector2.one; + dstTransform.sizeDelta = Vector2.zero; + separatorParts.Add(go.transform); } } diff --git a/spine-unity/Assets/Spine/package.json b/spine-unity/Assets/Spine/package.json index e6c56d0de5..be89e26592 100644 --- a/spine-unity/Assets/Spine/package.json +++ b/spine-unity/Assets/Spine/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.spine-unity", "displayName": "spine-unity Runtime", "description": "This plugin provides the spine-unity runtime core.", - "version": "4.1.15", + "version": "4.1.16", "unity": "2018.3", "author": { "name": "Esoteric Software", diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs index 68aacb9d6f..d38a16684e 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/Runtime/SpineAnimationState/SpineAnimationStateMixerBehaviour.cs @@ -68,7 +68,8 @@ ScriptPlayable[] startingClips } public override void OnGraphStop (Playable playable) { - if (!isPaused && endAtClipEnd) + bool isStoppedNotPaused = playable.GetGraph().IsPlaying(); // end of track was reached or graph stopped. + if (isStoppedNotPaused && endAtClipEnd) HandleClipEnd(); } diff --git a/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json b/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json index cb08721372..f7e25a8a31 100644 --- a/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json +++ b/spine-unity/Modules/com.esotericsoftware.spine.timeline/package.json @@ -2,7 +2,7 @@ "name": "com.esotericsoftware.spine.timeline", "displayName": "Spine Timeline Extensions", "description": "This plugin provides integration of spine-unity for the Unity Timeline.\n\nPrerequisites:\nIt requires a working installation of the spine-unity and spine-csharp runtimes as UPM packages (not as spine-unity unitypackage), version 4.1.\n(See http://esotericsoftware.com/git/spine-runtimes/spine-unity)", - "version": "4.1.11", + "version": "4.1.12", "unity": "2018.3", "author": { "name": "Esoteric Software",