自動生成Spine 文件的 prefab

using UnityEditor;  

using UnityEngine;  

using System;
using System.IO;
using System.Text;

using System.Collections;
using System.Collections.Generic;

using Spine.Unity;

public class SpineMaker
{  
	/// <summary>
	/// 自動生成 spine . prefab
	/// </summary>
	[MenuItem("Tools/Spine/MakeSpinePrefab")]  
	static void SpineMakeSpinePrefab()  {

		GameObject oo = new GameObject("4001001");
		oo.AddComponent<MeshFilter>();
		oo.AddComponent<MeshRenderer>();
		oo.AddComponent<SkeletonAnimation>();

		SkeletonAnimation ske = oo.GetComponent<SkeletonAnimation>();
		ske.skeletonDataAsset = (SkeletonDataAsset) Resources.Load("Animation/400/4000001/" +  "4000001_SkeletonData") as SkeletonDataAsset;
		ske.AnimationName = "play";

		string path = "Assets/"+"Editor/" + "411" + ".prefab";

		PrefabUtility.CreatePrefab(path,oo);

	}
	
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章