Unity Editor的一些常用操作缩略图
内容纲要

语雀:https://www.yuque.com/cgsgood/dshx0b/pblody
个人博客: https://www.cgsgood.tech/unity_editor_usual/

  1. 获取选中的节点

    GameObject go = Selection.activeGameObject;
  2. 判断对象是否是从prefab或者fbx拖到场景中的

    if (PrefabUtility.GetPrefabInstanceStatus(go) == PrefabInstanceStatus.Connected)
  3. 获取prefab/fbx实例化对象的文件路径

    string fbxPath = AssetDatabase.GetAssetPath(PrefabUtility.GetCorrespondingObjectFromSource(go));
  4. 文件保存到剪切板

    UnityEngine.GUIUtility.systemCopyBuffer = newFbxPath;
  5. 用文件浏览器定位到文件所在路径

    EditorUtility.RevealInFinder(newFbxPath);
最后修改日期: 2022年11月1日

作者