@mflrevan/ucp 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/README.md +1 -1
  2. package/bridge/com.ucp.bridge/CHANGELOG.md +145 -0
  3. package/bridge/com.ucp.bridge/CHANGELOG.md.meta +7 -0
  4. package/bridge/com.ucp.bridge/Editor/Bridge/BridgeServer.cs +583 -0
  5. package/bridge/com.ucp.bridge/Editor/Bridge/BridgeServer.cs.meta +2 -0
  6. package/bridge/com.ucp.bridge/Editor/Bridge.meta +8 -0
  7. package/bridge/com.ucp.bridge/Editor/Compatibility/UnityObjectCompat.cs +18 -0
  8. package/bridge/com.ucp.bridge/Editor/Compatibility/UnityObjectCompat.cs.meta +2 -0
  9. package/bridge/com.ucp.bridge/Editor/Compatibility.meta +8 -0
  10. package/bridge/com.ucp.bridge/Editor/Controllers/AssetController.cs +425 -0
  11. package/bridge/com.ucp.bridge/Editor/Controllers/AssetController.cs.meta +2 -0
  12. package/bridge/com.ucp.bridge/Editor/Controllers/AssetImportSupport.cs +355 -0
  13. package/bridge/com.ucp.bridge/Editor/Controllers/AssetImportSupport.cs.meta +2 -0
  14. package/bridge/com.ucp.bridge/Editor/Controllers/BuildController.cs +233 -0
  15. package/bridge/com.ucp.bridge/Editor/Controllers/BuildController.cs.meta +2 -0
  16. package/bridge/com.ucp.bridge/Editor/Controllers/CompilationController.cs +26 -0
  17. package/bridge/com.ucp.bridge/Editor/Controllers/CompilationController.cs.meta +2 -0
  18. package/bridge/com.ucp.bridge/Editor/Controllers/EditorController.cs +31 -0
  19. package/bridge/com.ucp.bridge/Editor/Controllers/EditorController.cs.meta +2 -0
  20. package/bridge/com.ucp.bridge/Editor/Controllers/EditorSettingsController.cs +527 -0
  21. package/bridge/com.ucp.bridge/Editor/Controllers/EditorSettingsController.cs.meta +2 -0
  22. package/bridge/com.ucp.bridge/Editor/Controllers/FileController.cs +141 -0
  23. package/bridge/com.ucp.bridge/Editor/Controllers/FileController.cs.meta +2 -0
  24. package/bridge/com.ucp.bridge/Editor/Controllers/HierarchyController.cs +326 -0
  25. package/bridge/com.ucp.bridge/Editor/Controllers/HierarchyController.cs.meta +2 -0
  26. package/bridge/com.ucp.bridge/Editor/Controllers/ImporterController.cs +209 -0
  27. package/bridge/com.ucp.bridge/Editor/Controllers/ImporterController.cs.meta +2 -0
  28. package/bridge/com.ucp.bridge/Editor/Controllers/LogsController.cs +409 -0
  29. package/bridge/com.ucp.bridge/Editor/Controllers/LogsController.cs.meta +2 -0
  30. package/bridge/com.ucp.bridge/Editor/Controllers/MaterialController.cs +354 -0
  31. package/bridge/com.ucp.bridge/Editor/Controllers/MaterialController.cs.meta +2 -0
  32. package/bridge/com.ucp.bridge/Editor/Controllers/ObjectReferenceResolver.cs +93 -0
  33. package/bridge/com.ucp.bridge/Editor/Controllers/ObjectReferenceResolver.cs.meta +2 -0
  34. package/bridge/com.ucp.bridge/Editor/Controllers/PackagesController.cs +503 -0
  35. package/bridge/com.ucp.bridge/Editor/Controllers/PackagesController.cs.meta +2 -0
  36. package/bridge/com.ucp.bridge/Editor/Controllers/PlayModeController.cs +188 -0
  37. package/bridge/com.ucp.bridge/Editor/Controllers/PlayModeController.cs.meta +2 -0
  38. package/bridge/com.ucp.bridge/Editor/Controllers/PrefabController.cs +260 -0
  39. package/bridge/com.ucp.bridge/Editor/Controllers/PrefabController.cs.meta +2 -0
  40. package/bridge/com.ucp.bridge/Editor/Controllers/ProfilerController.cs +1679 -0
  41. package/bridge/com.ucp.bridge/Editor/Controllers/ProfilerController.cs.meta +2 -0
  42. package/bridge/com.ucp.bridge/Editor/Controllers/PropertyController.cs +579 -0
  43. package/bridge/com.ucp.bridge/Editor/Controllers/PropertyController.cs.meta +2 -0
  44. package/bridge/com.ucp.bridge/Editor/Controllers/SceneChangeTracker.cs +166 -0
  45. package/bridge/com.ucp.bridge/Editor/Controllers/SceneChangeTracker.cs.meta +2 -0
  46. package/bridge/com.ucp.bridge/Editor/Controllers/SceneController.cs +318 -0
  47. package/bridge/com.ucp.bridge/Editor/Controllers/SceneController.cs.meta +2 -0
  48. package/bridge/com.ucp.bridge/Editor/Controllers/ScreenshotController.cs +125 -0
  49. package/bridge/com.ucp.bridge/Editor/Controllers/ScreenshotController.cs.meta +2 -0
  50. package/bridge/com.ucp.bridge/Editor/Controllers/ScriptController.cs +104 -0
  51. package/bridge/com.ucp.bridge/Editor/Controllers/ScriptController.cs.meta +2 -0
  52. package/bridge/com.ucp.bridge/Editor/Controllers/SnapshotController.cs +227 -0
  53. package/bridge/com.ucp.bridge/Editor/Controllers/SnapshotController.cs.meta +2 -0
  54. package/bridge/com.ucp.bridge/Editor/Controllers/TestRunnerController.cs +240 -0
  55. package/bridge/com.ucp.bridge/Editor/Controllers/TestRunnerController.cs.meta +2 -0
  56. package/bridge/com.ucp.bridge/Editor/Controllers/VcsController.cs +611 -0
  57. package/bridge/com.ucp.bridge/Editor/Controllers/VcsController.cs.meta +2 -0
  58. package/bridge/com.ucp.bridge/Editor/Controllers.meta +8 -0
  59. package/bridge/com.ucp.bridge/Editor/Protocol/CommandRouter.cs +53 -0
  60. package/bridge/com.ucp.bridge/Editor/Protocol/CommandRouter.cs.meta +2 -0
  61. package/bridge/com.ucp.bridge/Editor/Protocol/MessageTypes.cs +80 -0
  62. package/bridge/com.ucp.bridge/Editor/Protocol/MessageTypes.cs.meta +2 -0
  63. package/bridge/com.ucp.bridge/Editor/Protocol/MiniJson.cs +358 -0
  64. package/bridge/com.ucp.bridge/Editor/Protocol/MiniJson.cs.meta +2 -0
  65. package/bridge/com.ucp.bridge/Editor/Protocol.meta +8 -0
  66. package/bridge/com.ucp.bridge/Editor/Scripts/IUCPScript.cs +37 -0
  67. package/bridge/com.ucp.bridge/Editor/Scripts/IUCPScript.cs.meta +2 -0
  68. package/bridge/com.ucp.bridge/Editor/Scripts.meta +8 -0
  69. package/bridge/com.ucp.bridge/Editor/UCP.Bridge.Editor.asmdef +18 -0
  70. package/bridge/com.ucp.bridge/Editor/UCP.Bridge.Editor.asmdef.meta +7 -0
  71. package/bridge/com.ucp.bridge/Editor.meta +8 -0
  72. package/bridge/com.ucp.bridge/Runtime/UCP.Bridge.Runtime.asmdef +14 -0
  73. package/bridge/com.ucp.bridge/Runtime/UCP.Bridge.Runtime.asmdef.meta +7 -0
  74. package/bridge/com.ucp.bridge/Runtime.meta +8 -0
  75. package/bridge/com.ucp.bridge/Tests/Editor/ControllerSmokeTests.cs +1085 -0
  76. package/bridge/com.ucp.bridge/Tests/Editor/ControllerSmokeTests.cs.meta +2 -0
  77. package/bridge/com.ucp.bridge/Tests/Editor/UCP.Bridge.Editor.Tests.asmdef +12 -0
  78. package/bridge/com.ucp.bridge/Tests/Editor/UCP.Bridge.Editor.Tests.asmdef.meta +7 -0
  79. package/bridge/com.ucp.bridge/Tests/Editor.meta +8 -0
  80. package/bridge/com.ucp.bridge/Tests.meta +8 -0
  81. package/bridge/com.ucp.bridge/package.json +29 -0
  82. package/bridge/com.ucp.bridge/package.json.meta +7 -0
  83. package/package.json +2 -2
  84. package/scripts/install.js +4 -6
@@ -0,0 +1,425 @@
1
+ using System;
2
+ using System.Collections.Generic;
3
+ using System.Reflection;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+
7
+ namespace UCP.Bridge
8
+ {
9
+ public static class AssetController
10
+ {
11
+ public static void Register(CommandRouter router)
12
+ {
13
+ router.Register("asset/search", HandleSearch);
14
+ router.Register("asset/info", HandleInfo);
15
+ router.Register("asset/read", HandleReadScriptableObject);
16
+ router.Register("asset/write", HandleWriteScriptableObject);
17
+ router.Register("asset/write-batch", HandleWriteScriptableObjectBatch);
18
+ router.Register("asset/create-so", HandleCreateScriptableObject);
19
+ router.Register("asset/delete", HandleDeleteAsset);
20
+ }
21
+
22
+ private static object HandleSearch(string paramsJson)
23
+ {
24
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
25
+ string typeFilter = null;
26
+ string nameFilter = null;
27
+ string pathFilter = null;
28
+ int maxResults = 100;
29
+
30
+ if (p != null)
31
+ {
32
+ if (p.TryGetValue("type", out var tObj) && tObj != null)
33
+ typeFilter = tObj.ToString();
34
+ if (p.TryGetValue("name", out var nObj) && nObj != null)
35
+ nameFilter = nObj.ToString();
36
+ if (p.TryGetValue("path", out var pObj) && pObj != null)
37
+ pathFilter = pObj.ToString();
38
+ if (p.TryGetValue("maxResults", out var mObj))
39
+ maxResults = Convert.ToInt32(mObj);
40
+ }
41
+
42
+ // Build search filter
43
+ string filter = "";
44
+ if (!string.IsNullOrEmpty(nameFilter))
45
+ filter += nameFilter + " ";
46
+ if (!string.IsNullOrEmpty(typeFilter))
47
+ filter += $"t:{GetSearchTypeFilter(typeFilter)}";
48
+
49
+ string[] searchFolders = null;
50
+ if (!string.IsNullOrEmpty(pathFilter))
51
+ searchFolders = new[] { pathFilter };
52
+
53
+ string[] guids;
54
+ if (searchFolders != null)
55
+ guids = AssetDatabase.FindAssets(filter.Trim(), searchFolders);
56
+ else
57
+ guids = AssetDatabase.FindAssets(filter.Trim());
58
+
59
+ var results = new List<object>();
60
+ int totalMatches = 0;
61
+ for (int i = 0; i < guids.Length; i++)
62
+ {
63
+ string assetPath = AssetDatabase.GUIDToAssetPath(guids[i]);
64
+ foreach (var asset in GetMatchingAssets(assetPath, typeFilter, nameFilter))
65
+ {
66
+ totalMatches++;
67
+ if (results.Count >= maxResults)
68
+ continue;
69
+
70
+ results.Add(new Dictionary<string, object>
71
+ {
72
+ ["guid"] = guids[i],
73
+ ["path"] = assetPath,
74
+ ["type"] = GetDisplayType(assetPath, asset),
75
+ ["name"] = asset.name,
76
+ ["isSubAsset"] = AssetDatabase.IsSubAsset(asset)
77
+ });
78
+ }
79
+ }
80
+
81
+ return new Dictionary<string, object>
82
+ {
83
+ ["results"] = results,
84
+ ["total"] = totalMatches,
85
+ ["returned"] = results.Count
86
+ };
87
+ }
88
+
89
+ private static object HandleInfo(string paramsJson)
90
+ {
91
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
92
+ if (p == null || !p.TryGetValue("path", out var pathObj))
93
+ throw new ArgumentException("Missing 'path' parameter");
94
+
95
+ string assetPath = pathObj.ToString();
96
+ var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
97
+ if (asset == null)
98
+ throw new ArgumentException($"Asset not found: {assetPath}");
99
+
100
+ var info = new Dictionary<string, object>
101
+ {
102
+ ["path"] = assetPath,
103
+ ["name"] = asset.name,
104
+ ["type"] = asset.GetType().Name,
105
+ ["fullType"] = asset.GetType().FullName,
106
+ ["instanceId"] = asset.GetInstanceID(),
107
+ ["guid"] = AssetDatabase.AssetPathToGUID(assetPath)
108
+ };
109
+
110
+ var importer = AssetImporter.GetAtPath(assetPath);
111
+ if (importer != null)
112
+ info["importerType"] = importer.GetType().Name;
113
+
114
+ // Add additional info for specific types
115
+ if (asset is GameObject go)
116
+ {
117
+ info["isPrefab"] = true;
118
+ var components = new List<string>();
119
+ foreach (var c in go.GetComponents<Component>())
120
+ {
121
+ if (c != null)
122
+ components.Add(c.GetType().Name);
123
+ }
124
+ info["components"] = components;
125
+ }
126
+
127
+ if (asset is ScriptableObject)
128
+ {
129
+ info["isScriptableObject"] = true;
130
+ }
131
+
132
+ return info;
133
+ }
134
+
135
+ private static object HandleReadScriptableObject(string paramsJson)
136
+ {
137
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
138
+ if (p == null || !p.TryGetValue("path", out var pathObj))
139
+ throw new ArgumentException("Missing 'path' parameter");
140
+
141
+ string assetPath = pathObj.ToString();
142
+ var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
143
+ if (asset == null)
144
+ throw new ArgumentException($"Asset not found: {assetPath}");
145
+
146
+ // Optional: read specific field only
147
+ string fieldName = null;
148
+ if (p.TryGetValue("field", out var fObj) && fObj != null)
149
+ fieldName = fObj.ToString();
150
+
151
+ var so = new SerializedObject(asset);
152
+ var fields = new List<object>();
153
+
154
+ if (fieldName != null)
155
+ {
156
+ var prop = so.FindProperty(fieldName);
157
+ if (prop == null)
158
+ throw new ArgumentException($"Field '{fieldName}' not found on {asset.GetType().Name}");
159
+
160
+ fields.Add(new Dictionary<string, object>
161
+ {
162
+ ["name"] = prop.name,
163
+ ["propertyPath"] = prop.propertyPath,
164
+ ["displayName"] = prop.displayName,
165
+ ["type"] = prop.propertyType.ToString(),
166
+ ["value"] = SerializedPropertyControllerSupport.ReadValue(prop)
167
+ });
168
+ }
169
+ else
170
+ {
171
+ var iter = so.GetIterator();
172
+ if (iter.NextVisible(true))
173
+ {
174
+ do
175
+ {
176
+ if (iter.name == "m_Script") continue;
177
+ fields.Add(SerializedPropertyControllerSupport.Describe(iter));
178
+ }
179
+ while (iter.NextVisible(false));
180
+ }
181
+ }
182
+
183
+ so.Dispose();
184
+
185
+ return new Dictionary<string, object>
186
+ {
187
+ ["path"] = assetPath,
188
+ ["name"] = asset.name,
189
+ ["type"] = asset.GetType().Name,
190
+ ["fields"] = fields
191
+ };
192
+ }
193
+
194
+ private static object HandleWriteScriptableObject(string paramsJson)
195
+ {
196
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
197
+ if (p == null || !p.TryGetValue("path", out var pathObj))
198
+ throw new ArgumentException("Missing 'path' parameter");
199
+ if (!p.TryGetValue("field", out var fieldObj) || fieldObj == null)
200
+ throw new ArgumentException("Missing 'field' parameter");
201
+ if (!p.ContainsKey("value"))
202
+ throw new ArgumentException("Missing 'value' parameter");
203
+
204
+ string assetPath = pathObj.ToString();
205
+ var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
206
+ if (asset == null)
207
+ throw new ArgumentException($"Asset not found: {assetPath}");
208
+
209
+ string fieldName = fieldObj.ToString();
210
+ var so = new SerializedObject(asset);
211
+ Undo.RecordObject(asset, $"UCP Write {fieldName}");
212
+ SerializedPropertyControllerSupport.WriteFieldValue(so, asset.GetType().Name, fieldName, p["value"]);
213
+ so.ApplyModifiedProperties();
214
+ EditorUtility.SetDirty(asset);
215
+ AssetDatabase.SaveAssetIfDirty(asset);
216
+ so.Dispose();
217
+
218
+ return new Dictionary<string, object>
219
+ {
220
+ ["status"] = "ok",
221
+ ["path"] = assetPath,
222
+ ["field"] = fieldName
223
+ };
224
+ }
225
+
226
+ private static object HandleWriteScriptableObjectBatch(string paramsJson)
227
+ {
228
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
229
+ if (p == null || !p.TryGetValue("path", out var pathObj))
230
+ throw new ArgumentException("Missing 'path' parameter");
231
+ if (!p.TryGetValue("values", out var valuesObj) || !(valuesObj is Dictionary<string, object> values))
232
+ throw new ArgumentException("Missing 'values' parameter");
233
+
234
+ string assetPath = pathObj.ToString();
235
+ var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>(assetPath);
236
+ if (asset == null)
237
+ throw new ArgumentException($"Asset not found: {assetPath}");
238
+
239
+ var so = new SerializedObject(asset);
240
+ Undo.RecordObject(asset, $"UCP Batch Write {asset.name}");
241
+
242
+ var fields = new List<object>();
243
+ foreach (var entry in values)
244
+ {
245
+ SerializedPropertyControllerSupport.WriteFieldValue(so, asset.GetType().Name, entry.Key, entry.Value);
246
+ fields.Add(entry.Key);
247
+ }
248
+
249
+ so.ApplyModifiedProperties();
250
+ EditorUtility.SetDirty(asset);
251
+ AssetDatabase.SaveAssetIfDirty(asset);
252
+ so.Dispose();
253
+
254
+ return new Dictionary<string, object>
255
+ {
256
+ ["status"] = "ok",
257
+ ["path"] = assetPath,
258
+ ["fields"] = fields
259
+ };
260
+ }
261
+
262
+ private static object HandleCreateScriptableObject(string paramsJson)
263
+ {
264
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
265
+ if (p == null || !p.TryGetValue("type", out var typeObj) || typeObj == null)
266
+ throw new ArgumentException("Missing 'type' parameter");
267
+ if (!p.TryGetValue("path", out var pathObj) || pathObj == null)
268
+ throw new ArgumentException("Missing 'path' parameter");
269
+
270
+ string typeName = typeObj.ToString();
271
+ string assetPath = pathObj.ToString();
272
+
273
+ // Resolve ScriptableObject type
274
+ Type soType = null;
275
+ foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
276
+ {
277
+ foreach (var t in assembly.GetTypes())
278
+ {
279
+ if (!typeof(ScriptableObject).IsAssignableFrom(t)) continue;
280
+ if (t.Name == typeName || t.FullName == typeName)
281
+ {
282
+ soType = t;
283
+ break;
284
+ }
285
+ }
286
+ if (soType != null) break;
287
+ }
288
+
289
+ if (soType == null)
290
+ throw new ArgumentException($"ScriptableObject type not found: {typeName}");
291
+
292
+ var instance = ScriptableObject.CreateInstance(soType);
293
+
294
+ // Ensure directory exists
295
+ string dir = System.IO.Path.GetDirectoryName(assetPath);
296
+ if (!string.IsNullOrEmpty(dir) && !AssetDatabase.IsValidFolder(dir))
297
+ {
298
+ CreateFoldersRecursive(dir);
299
+ }
300
+
301
+ AssetDatabase.CreateAsset(instance, assetPath);
302
+ AssetDatabase.SaveAssets();
303
+
304
+ return new Dictionary<string, object>
305
+ {
306
+ ["status"] = "ok",
307
+ ["path"] = assetPath,
308
+ ["type"] = soType.Name,
309
+ ["instanceId"] = instance.GetInstanceID()
310
+ };
311
+ }
312
+
313
+ private static object HandleDeleteAsset(string paramsJson)
314
+ {
315
+ var p = MiniJson.Deserialize(paramsJson) as Dictionary<string, object>;
316
+ if (p == null || !p.TryGetValue("path", out var pathObj) || pathObj == null)
317
+ throw new ArgumentException("Missing 'path' parameter");
318
+
319
+ string assetPath = pathObj.ToString();
320
+ var normalizedPath = assetPath.Replace("\\", "/");
321
+ if (!AssetDatabase.AssetPathExists(normalizedPath))
322
+ throw new ArgumentException($"Asset not found: {normalizedPath}");
323
+
324
+ if (!AssetDatabase.DeleteAsset(normalizedPath))
325
+ throw new InvalidOperationException($"Failed to delete asset: {normalizedPath}");
326
+
327
+ AssetDatabase.SaveAssets();
328
+ AssetDatabase.Refresh();
329
+
330
+ return new Dictionary<string, object>
331
+ {
332
+ ["status"] = "ok",
333
+ ["path"] = normalizedPath
334
+ };
335
+ }
336
+
337
+ private static void CreateFoldersRecursive(string path)
338
+ {
339
+ var parts = path.Replace("\\", "/").Split('/');
340
+ string current = parts[0];
341
+ for (int i = 1; i < parts.Length; i++)
342
+ {
343
+ string next = current + "/" + parts[i];
344
+ if (!AssetDatabase.IsValidFolder(next))
345
+ AssetDatabase.CreateFolder(current, parts[i]);
346
+ current = next;
347
+ }
348
+ }
349
+
350
+ private static IEnumerable<UnityEngine.Object> GetMatchingAssets(string assetPath, string typeFilter, string nameFilter)
351
+ {
352
+ UnityEngine.Object[] candidates;
353
+ if (string.IsNullOrEmpty(typeFilter) && string.IsNullOrEmpty(nameFilter))
354
+ {
355
+ var mainAsset = AssetDatabase.LoadMainAssetAtPath(assetPath);
356
+ candidates = mainAsset != null ? new[] { mainAsset } : Array.Empty<UnityEngine.Object>();
357
+ }
358
+ else
359
+ {
360
+ candidates = AssetDatabase.LoadAllAssetsAtPath(assetPath);
361
+ }
362
+
363
+ foreach (var candidate in candidates)
364
+ {
365
+ if (candidate == null) continue;
366
+ if (!MatchesName(candidate, assetPath, nameFilter)) continue;
367
+ if (!MatchesType(candidate, assetPath, typeFilter)) continue;
368
+ yield return candidate;
369
+ }
370
+ }
371
+
372
+ private static bool MatchesName(UnityEngine.Object asset, string assetPath, string nameFilter)
373
+ {
374
+ if (string.IsNullOrEmpty(nameFilter))
375
+ return true;
376
+
377
+ return asset.name.Contains(nameFilter, StringComparison.OrdinalIgnoreCase)
378
+ || System.IO.Path.GetFileNameWithoutExtension(assetPath).Contains(nameFilter, StringComparison.OrdinalIgnoreCase);
379
+ }
380
+
381
+ private static bool MatchesType(UnityEngine.Object asset, string assetPath, string typeFilter)
382
+ {
383
+ if (string.IsNullOrEmpty(typeFilter))
384
+ return true;
385
+
386
+ if (typeFilter.Equals("Prefab", StringComparison.OrdinalIgnoreCase))
387
+ {
388
+ return asset is GameObject
389
+ && !AssetDatabase.IsSubAsset(asset)
390
+ && assetPath.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase);
391
+ }
392
+
393
+ var normalizedType = NormalizeTypeFilter(typeFilter);
394
+ var assetType = asset.GetType();
395
+ return assetType.Name.Equals(normalizedType, StringComparison.OrdinalIgnoreCase)
396
+ || (assetType.FullName != null && assetType.FullName.Equals(normalizedType, StringComparison.OrdinalIgnoreCase));
397
+ }
398
+
399
+ private static string GetDisplayType(string assetPath, UnityEngine.Object asset)
400
+ {
401
+ if (asset is GameObject
402
+ && !AssetDatabase.IsSubAsset(asset)
403
+ && assetPath.EndsWith(".prefab", StringComparison.OrdinalIgnoreCase))
404
+ {
405
+ return "Prefab";
406
+ }
407
+
408
+ return asset.GetType().Name;
409
+ }
410
+
411
+ private static string GetSearchTypeFilter(string typeFilter)
412
+ {
413
+ if (typeFilter.Equals("Prefab", StringComparison.OrdinalIgnoreCase))
414
+ return "GameObject";
415
+
416
+ return NormalizeTypeFilter(typeFilter);
417
+ }
418
+
419
+ private static string NormalizeTypeFilter(string typeFilter)
420
+ {
421
+ return typeFilter?.Trim() ?? string.Empty;
422
+ }
423
+
424
+ }
425
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: bc9394bede1a4b14a8c95bbbccf6e41d