nafio

http://tsubakit1.hateblo.jp/entry/2015/06/01/235939


using UnityEngine;
using UnityEditor;
using System.IO;

public class Copy
{
	[MenuItem("Assets/Copy")]
	static void AssetCopy ()
	{
		// AnimationClipを持つFBXのパス
		string fbxPath = "Assets/UnityChan/SD_unitychan/Animations/SD_unitychan_motion_Generic.fbx";
		// AnimationClipのファイル名
		string clipName = "GoDown";
		// AnimationClipの出力先
		string exportPath = "Assets/Clone.anim";

		string tempExportedClip = "Assets/tempClip.anim";

		// AnimationClipの取得
		var animations = AssetDatabase.LoadAllAssetsAtPath (fbxPath);
		var originalClip = System.Array.Find<Object> (animations, item =>
	   		item is AnimationClip && item.name == clipName
		);
	
		// AnimationClipをコピーして出力(ユニークなuuid)
		var copyClip = Object.Instantiate (originalClip);
		AssetDatabase.CreateAsset (copyClip, tempExportedClip);

		// AnimationClipのコピー(固定化したuuid)
		File.Copy (tempExportedClip, exportPath, true);
		File.Delete (tempExportedClip);

		// AssetDatabaseリフレッシュ
		AssetDatabase.Refresh ();
	}
}




分类:

技术点:

相关文章:

  • 2021-07-27
  • 2021-09-23
  • 2021-09-01
  • 2021-09-13
  • 2021-04-02
  • 2022-01-07
猜你喜欢
  • 2021-07-23
  • 2021-08-09
  • 2021-09-01
  • 2021-06-04
  • 2021-11-18
  • 2021-08-20
相关资源
相似解决方案