ThreadNotSupported
Specifies that an evaluator does not support worker thread evaluation and should only be evaluated in the main thread. This could be the case if an evaluator is using non-tread safe Unity API (like AssetDatabase ).
Read time 1 minuteLast updated 13 days ago
Definition
- Type: Field
- Namespace: UnityEditor.Search
- Assembly: UnityEditor
ThreadNotSupported = 2
Examples
[Description("Returns asset paths corresponding to a list of instance ids")][SearchExpressionEvaluator("IdsToPaths", SearchExpressionEvaluationHints.ThreadNotSupported, SearchExpressionType.Iterable)]public static IEnumerable<SearchItem> IdsToPath(SearchExpressionContext c){ foreach (var idItem in c.args[0].Execute(c)) { if (SearchExpression.TryConvertToULong(idItem, out var idNum)) { var id = UnsafeUtility.As<ulong, EntityId>(ref idNum); var path = AssetDatabase.GetAssetPath(id); if (!string.IsNullOrEmpty(path)) { yield return SearchExpression.CreateItem(path, c.ResolveAlias("asset path")); } } }}