内容纲要
语雀:https://www.yuque.com/cgsgood/dshx0b/pblody
个人博客: https://www.cgsgood.tech/unity_editor_usual/
-
获取选中的节点
GameObject go = Selection.activeGameObject; -
判断对象是否是从prefab或者fbx拖到场景中的
if (PrefabUtility.GetPrefabInstanceStatus(go) == PrefabInstanceStatus.Connected) -
获取prefab/fbx实例化对象的文件路径
string fbxPath = AssetDatabase.GetAssetPath(PrefabUtility.GetCorrespondingObjectFromSource(go)); -
文件保存到剪切板
UnityEngine.GUIUtility.systemCopyBuffer = newFbxPath; -
用文件浏览器定位到文件所在路径
EditorUtility.RevealInFinder(newFbxPath);