コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 protected bool Equals(UnityAssetOccurrence other)
 {
     return(SourceFile.Equals(other.SourceFile) && AttachedElementLocation.Equals(other.AttachedElementLocation));
 }