Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.2.8 - 2026-04-20
- Cache types only when required in SearchTool (89b7ab7)

## v1.2.7 - 2026-01-12
- Fix (c6b3903)
- Fix empty assetPath (30a816a)
Expand Down
30 changes: 17 additions & 13 deletions Editor/SearchTool/SearchToolWindowSearchProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@ public static void Show(Action<Type> onSelectedType)
internal static SearchProvider CreateProvider()
{
var icon = EditorGUIUtility.IconContent("cs Script Icon").image;
if (targetTypes == null)
{
var typesList = new List<Type>();
var allTypes = TypeUtils.GetAllTypesInCurrentDomain();
var interfaces = allTypes.Where(t => (t.IsInterface || t.IsAbstract) && t.IsGenericType == false);
var nonUnityObjectTypes =
allTypes.Where(t =>
t.IsClass && t.IsSubclassOf(typeof(UnityEngine.Object)) == false);
typesList.AddRange(interfaces);
typesList.AddRange(nonUnityObjectTypes);
targetTypes = typesList;
}

return new SearchProvider(providerId, "Search Target Type")
{
Expand All @@ -65,6 +53,7 @@ internal static SearchProvider CreateProvider()
IEnumerable<SearchItem> FetchItems(SearchContext context, List<SearchItem> items,
SearchProvider provider)
{
CacheTypes();
var query = context.searchQuery.ToLowerInvariant();
var words = query.Split(' ');
var newItems = targetTypes.Where(TargetTypeIsContainsQuery).Select(CreateSearchItem);
Expand All @@ -86,7 +75,22 @@ bool TargetTypeIsContainsQuery(Type type)

return true;
}


void CacheTypes()
{
if (targetTypes == null)
{
var typesList = new List<Type>();
var allTypes = TypeUtils.GetAllTypesInCurrentDomain();
var interfaces = allTypes.Where(t => (t.IsInterface || t.IsAbstract) && t.IsGenericType == false);
var nonUnityObjectTypes =
allTypes.Where(t =>
t.IsClass && t.IsSubclassOf(typeof(UnityEngine.Object)) == false);
typesList.AddRange(interfaces);
typesList.AddRange(nonUnityObjectTypes);
targetTypes = typesList;
}
}

SearchItem CreateSearchItem(Type t)
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.alexeytaranov.serializereferencedropdown",
"version": "1.2.7",
"version": "1.2.8",
"displayName": "SerializeReferenceDropdown",
"description": "Editor dropdown for SerializeReference Attribute",
"unity": "2019.3",
Expand Down