void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; firstLeftHandLocalPos = leftHand.localPosition; normalMesh = spriteMeshInstance.spriteMesh; animator = GetComponent <Animator>(); }
static void SayHelloFromMenuBar2() { if (Selection.assetGUIDs == null || Selection.assetGUIDs.Length == 0) { return; } foreach (string _assetGuid in Selection.assetGUIDs) { string _assetPath = AssetDatabase.GUIDToAssetPath(_assetGuid); //Debug.Log("assetGUID:" + _assetGuid + ", assetPath" + _assetPath); Anima2D.SpriteMesh _spriteMesh = AssetDatabase.LoadAssetAtPath <Anima2D.SpriteMesh>(_assetPath); // Object で取得した際にデバッグで型を確認した。 if (_spriteMesh == null) { Debug.LogError(string.Format("SCAnima2DHelper: SCMultiSpriteMeshInstantiate.cs :LoadMainAssetAtPath failed. assetGUID = {0}, assetPath = {1}", _assetGuid, _assetPath)); return; } Object _spriteMeshInstance = Anima2D.SpriteMeshUtils.CreateSpriteMeshInstance(_spriteMesh, false); if (_spriteMeshInstance == null) { Debug.LogError("SCAnima2DHelper: SCMultiSpriteMeshInstantiate.cs :Instantiate failed."); } } }
static private void BuildAssetBundleSpriteMesh(string atlasName) { DirectoryInfo rootDirInfo = new DirectoryInfo(Application.dataPath + "/Atlas/SpriteMesh"); foreach (DirectoryInfo dirInfo in rootDirInfo.GetDirectories()) { if (!string.IsNullOrEmpty(atlasName) && dirInfo.Name != atlasName) { continue; } var asset = ScriptableObject.CreateInstance <App.Model.Scriptable.AvatarSpriteAsset>(); List <Anima2D.SpriteMesh> meshs = new List <Anima2D.SpriteMesh>(); foreach (FileInfo pngFile in dirInfo.GetFiles("*.asset", SearchOption.AllDirectories)) { string allPath = pngFile.FullName; Debug.LogError("allPath = " + allPath); Anima2D.SpriteMesh obj = AssetDatabase.LoadAssetAtPath <Anima2D.SpriteMesh>(allPath.Substring(allPath.IndexOf("Assets"))); obj.name = System.IO.Path.GetFileNameWithoutExtension(pngFile.Name); meshs.Add(obj); } asset.meshs = meshs.ToArray(); UnityEditor.AssetDatabase.CreateAsset(asset, string.Format("Assets/Editor Default Resources/ScriptableObject/{0}mesh.asset", dirInfo.Name)); UnityEditor.AssetDatabase.Refresh(); BuildAssetBundleMaster(dirInfo.Name + "mesh"); } Debug.LogError("BuildAssetBundleSpriteMesh over "); }