瀏覽代碼

[unity] SkeletonRenderTexture: automatically assigning RenderQuadMaterial upon component reset.

Harald Csaszar 2 年之前
父節點
當前提交
39a957c91f

+ 11 - 0
spine-unity/Assets/Spine Examples/Scripts/Sample Components/SkeletonRenderTexture/SkeletonRenderTexture.cs

@@ -73,6 +73,17 @@ namespace Spine.Unity.Examples {
 			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<Material>(materialPath);
+			}
+		}
+#endif
+
 		void CreateQuadChild () {
 			quad = new GameObject(this.name + " RenderTexture", typeof(MeshRenderer), typeof(MeshFilter));
 			quad.transform.SetParent(this.transform.parent, false);

+ 1 - 1
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",