public static string GetAttachedGameObjectName(UnitySceneDataLocalCache cache, IYamlDocument document) { var consumer = new UnityPathCachedSceneConsumer(); cache.ProcessSceneHierarchyFromComponentToRoot(document, consumer); var parts = consumer.NameParts; if (parts.Count == 0) { return("..."); } return(string.Join("/", consumer.NameParts)); }
public static string GetGameObjectPathFromComponent([NotNull] UnitySceneDataLocalCache localCache, [NotNull] IPsiSourceFile file, string anchor) { var consumer = new UnityPathCachedSceneConsumer(); localCache.ProcessSceneHierarchyFromComponentToRoot(file, anchor, consumer); var parts = consumer.NameParts; if (parts.Count == 0) { return("..."); } return(string.Join("\\", parts)); }
public static FindUsageResultElement CreateRequest([NotNull] FileSystemPath solutionDirPath, [NotNull] UnitySceneDataLocalCache unitySceneDataLocalCache, [NotNull] string anchor, IPsiSourceFile sourceFile, bool needExpand = false) { if (!GetPathFromAssetFolder(solutionDirPath, sourceFile, out var pathFromAsset, out var fileName, out var extension)) { return(null); } bool isPrefab = extension.Equals(UnityYamlConstants.Prefab, StringComparison.OrdinalIgnoreCase); var consumer = new UnityPathCachedSceneConsumer(); unitySceneDataLocalCache.ProcessSceneHierarchyFromComponentToRoot(sourceFile, anchor, consumer); return(new FindUsageResultElement(isPrefab, needExpand, pathFromAsset, fileName, consumer.NameParts.ToArray(), consumer.RootIndexes.ToArray())); }