Exemplo n.º 1
0
        internal IEnumerable <SearchItem> SelectPath(SearchItem item)
        {
            var obj = item.provider?.toObject?.Invoke(item, typeof(UnityEngine.Object));

            if (!obj)
            {
                return new [] { item }
            }
            ;

            var path = AssetDatabase.GetAssetPath(obj);

            if (!String.IsNullOrEmpty(path))
            {
                return new [] { new SearchItem(path) }
            }
            ;

            if (obj is GameObject go)
            {
                return new [] { new SearchItem(SearchUtils.GetHierarchyPath(go)) }
            }
            ;

            return(new [] { item });
        }
Exemplo n.º 2
0
        public override bool GetDescription(Object obj, StringBuilder sb)
        {
            AddSeparatorIfNeeded(sb);
            var go = obj as GameObject;

            if (go.scene.IsValid())
            {
                sb.AppendFormat("{0} ({1})", SearchUtils.GetHierarchyPath(go), go.tag);
            }
            else
            {
                sb.Append(go.tag);
            }
            return(true);
        }