From 39a957c91f1bc39b2e8b68c7593d6c06b420cf25 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Wed, 19 Jul 2023 11:37:19 +0200 Subject: [PATCH] [unity] SkeletonRenderTexture: automatically assigning RenderQuadMaterial upon component reset. --- .../SkeletonRenderTexture/SkeletonRenderTexture.cs | 11 +++++++++++ spine-unity/Assets/Spine Examples/package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) 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",