From 955972cc005117cb2e03fe4530f67f09d9be4bb7 Mon Sep 17 00:00:00 2001 From: yasirkula Date: Thu, 19 Mar 2026 13:55:21 +0300 Subject: [PATCH] Fixed search getting stuck in play mode if a pending Task is searched by reflection --- Plugins/AssetUsageDetector/Editor/Utilities.cs | 5 +++++ Plugins/AssetUsageDetector/README.txt | 2 +- package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/AssetUsageDetector/Editor/Utilities.cs b/Plugins/AssetUsageDetector/Editor/Utilities.cs index 6655288..8261df4 100644 --- a/Plugins/AssetUsageDetector/Editor/Utilities.cs +++ b/Plugins/AssetUsageDetector/Editor/Utilities.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Reflection; using System.Text; +using System.Threading.Tasks; using Unity.Collections; using UnityEditor; using UnityEditor.SceneManagement; @@ -359,6 +360,10 @@ namespace AssetUsageDetectorNamespace if( typeof( Type ).IsAssignableFrom( type ) || type.Namespace == reflectionNamespace ) return true; + // Searching Tasks for reference may freeze Unity since Task.Result freezes the active thread if Task hasn't completed yet + if (typeof(Task).IsAssignableFrom(type)) + return true; + // Searching pointers, ref variables or ref structs for reference throws ArgumentException if (type.IsPointer || type.IsByRef || type.IsByRefLike) return true; diff --git a/Plugins/AssetUsageDetector/README.txt b/Plugins/AssetUsageDetector/README.txt index e5d96e7..3a99765 100644 --- a/Plugins/AssetUsageDetector/README.txt +++ b/Plugins/AssetUsageDetector/README.txt @@ -1,4 +1,4 @@ -= Asset Usage Detector (v2.6.0) = += Asset Usage Detector (v2.6.1) = Documentation: https://github.com/yasirkula/UnityAssetUsageDetector E-mail: yasirkula@gmail.com \ No newline at end of file diff --git a/package.json b/package.json index cb0d81c..e38a103 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "com.yasirkula.assetusagedetector", "displayName": "Asset Usage Detector", - "version": "2.6.0", + "version": "2.6.1", "documentationUrl": "https://github.com/yasirkula/UnityAssetUsageDetector", "changelogUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/releases", "licensesUrl": "https://github.com/yasirkula/UnityAssetUsageDetector/blob/master/LICENSE.txt",