private string GetAttachedGameObjectName(AssetHierarchyProcessor processor, UnityAssetOccurrence occurrence) { var consumer = new UnityScenePathGameObjectConsumer(); processor.ProcessSceneHierarchyFromComponentToRoot(occurrence.AttachedElementLocation, consumer, true, true); var parts = consumer.NameParts; if (parts.Count == 0) { return("..."); } return(string.Join("/", consumer.NameParts)); }
protected RichText GetDisplayText(UnityAssetOccurrence occurrence) { if (occurrence.SourceFile.GetLocation().IsAsset()) { return("Scriptable Object"); } var processor = occurrence.GetSolution().NotNull("occurrence.GetSolution() != null").GetComponent <AssetHierarchyProcessor>(); var name = GetAttachedGameObjectName(processor, occurrence); if (occurrence is UnityInspectorValuesOccurrence inspectorValuesOccurrence) { var solution = occurrence.GetSolution(); var valuePresentation = inspectorValuesOccurrence.InspectorVariableUsage.Value.GetPresentation(solution, occurrence.DeclaredElementPointer.FindDeclaredElement(), true); if (inspectorValuesOccurrence.SourceFile.GetLocation().IsAsset()) { return(valuePresentation); } return($"{valuePresentation} in {name}"); } return(name); }
protected bool Equals(UnityAssetOccurrence other) { return(SourceFile.Equals(other.SourceFile) && AttachedElementLocation.Equals(other.AttachedElementLocation)); }