modelPath | 要查找匹配的引用剪辑的模型。 |
string[] 与给定模型匹配的引用剪辑 GUID 数组。
返回与给定模型名称匹配的所有引用剪辑。
注意:引用剪辑根据 EditorSettings.referencedClipsExactNaming 项目设置与给定模型匹配。
using UnityEditor; using UnityEngine;
public class TestMenus { // Create a menu named "Log Referenced Clips" in the "Tests" menu [MenuItem("Tests/Log Referenced Clips")] static void LogReferencedClips() { var modelPath = "Assets/Characters/Asset.fbx"; Debug.Log($"Referenced Clips for {modelPath}:");
var referencedClips = ModelImporter.GetReferencedClipsForModelPath(modelPath); foreach (var referencedClip in referencedClips) Debug.Log($"--Clip: {AssetDatabase.GUIDToAssetPath(referencedClip)}");
// Output: // Referenced Clips for Assets/Characters/Asset.fbx: // --Clip: Assets/Characters/Asset@Jump.fbx // --Clip: Assets/Characters/Asset@Run.fbx // --Clip: Assets/Characters/Asset@Walk.fbx } }