private static void CopyGameObjectPath() { UnityEngine.Object obj = Selection.activeObject; if (obj == null) { Debug.LogError("You must select Obj first!"); return; } string result = AssetDatabase.GetAssetPath(obj); if (string.IsNullOrEmpty(result))//如果不是资源则在场景中查找 { Transform selectChild = Selection.activeTransform; if (selectChild != null) { result = selectChild.name; while (selectChild.parent != null) { selectChild = selectChild.parent; result = string.Format("{0}/{1}", selectChild.name, result); } } } ClipBoard.Copy(result); Debug.Log(string.Format("The gameobject:{0}'s path has been copied to the clipboard!", obj.name)); }
static public void GenerateHotfixIndexFile() { HotfixIndexFile indexFile = new HotfixIndexFile(); #if UNITY_IOS FileInfo mainfestFile = new FileInfo(HotfixBuild.BundleFilesDir + "/iOS"); #else FileInfo mainfestFile = new FileInfo(HotfixBuild.BundleFilesDir + "/Android"); #endif if (mainfestFile.Exists) { indexFile.AddFile(mainfestFile); } FileInfo[] files = GetDirFiles(HotfixBuild.HotfixDir); for (int i = 0; i < files.Length; i++) { indexFile.AddFile(files[i]); } int version = HotfixBuild.GetHotfixVersion(); string fileName = HotfixBuild.HotfixDir + "/HotfixConfig_v" + version + ".zip"; indexFile.GenerateBin(fileName, HotfixFileFormat.EncryptZip, version); ClipBoard.Copy(MD5Util.Get(fileName)); EditorUtility.DisplayDialog("GenerateHotfixIndexFile", "生成HotfixIndexFile完成!", "Close"); }
private static void CopyGameObjectPath() { UnityEngine.Object obj = Selection.activeObject; if (obj == null) { Debug.LogError("No GameObject"); return; } string result = AssetDatabase.GetAssetPath(obj); // 如果不是资源则在场景中查找 if (string.IsNullOrEmpty(result)) { result = AnimationUtility.CalculateTransformPath(Selection.activeTransform, null); } ClipBoard.Copy(result); Debug.Log(string.Format("<color=green>[Path]</color>:{0} - {1}", obj.name, result)); }