Skip to content

[UUM-137284] Fixing warnings of 6.4+ due to obsoleted APIs#750

Open
LeoUnity wants to merge 2 commits intoupdate_cifrom
update_ci_fix_obsolete_warning
Open

[UUM-137284] Fixing warnings of 6.4+ due to obsoleted APIs#750
LeoUnity wants to merge 2 commits intoupdate_cifrom
update_ci_fix_obsolete_warning

Conversation

@LeoUnity
Copy link
Collaborator

@LeoUnity LeoUnity commented Mar 17, 2026

Purpose of this PR

Ticket/Jira #: UUM-137284

Fixing 2 warnings:

``(...)\com.unity.formats.fbx\com.unity.formats.fbx\Editor\ConvertToNestedPrefab.cs(277,30): warning CS0618: 'EntityId.GetRawData()' is obsolete: 'Please use EntityId.ToULong(EntityId) instead.'```

``(...)\com.unity.formats.fbx\com.unity.formats.fbx\Editor\ConvertToNestedPrefab.cs(286,29): warning CS0618: 'SearchService.GetItems(SearchContext, SearchFlags)' is obsolete: 'GetItems is deprecated, please use Request instead. GetItems will be removed in a future version.'````

Testing

Functional Testing status:

Performance Testing status:

Documentation & UX Writing

User facing text to review Details
User interface
Public API docs
Changelog
Documentation halo effect Jira link
User manual
Other docs

Additional information

Note to reviewers:

Reminder:

Copy link

@u-pr u-pr bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May require changes
The review has identified several issues in ConvertToNestedPrefab.cs, including potential compilation errors on older Unity versions, null safety concerns, and performance implications of synchronous search operations. Summary of new findings:

  • High Importance: Potential compilation errors related to EntityId.ToULong usage and ISearchList return types.
  • Medium Importance: Risk of NullReferenceException when resolving search results.
  • Low Importance: Use of synchronous search requests may impact Editor performance.

🤖 Helpful? 👍/👎

Comment on lines +286 to +290
#if UNITY_6000_5_OR_NEWER
var items = UnityEditor.Search.SearchService.GetItems(searchContext, SearchFlags.Synchronous);
#else
var items = UnityEditor.Search.SearchService.Request(searchContext, SearchFlags.Synchronous);
#endif
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low
Using SearchFlags.Synchronous and creating a new SearchContext (line 283) inside this method can significantly impact performance and lead to UI freezes in the Editor, especially in large projects. If GetSceneReferences is called frequently (e.g., in a loop over many objects), consider reusing the SearchContext or using an asynchronous search request with a callback.

🤖 Helpful? 👍/👎

#else
var items = UnityEditor.Search.SearchService.Request(searchContext, SearchFlags.Synchronous);
#endif
return items.ConvertAll(x => x.ToObject());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium
Have you considered that x.ToObject() might return null if the search result cannot be resolved to a valid UnityEngine.Object (e.g., if the object was destroyed or is in an unloaded scene)? To improve robustness, you might want to filter out these null values before returning the list to avoid potential NullReferenceExceptions in the caller. For example:

return items.Select(x => x.ToObject()).Where(obj => obj != null).ToList();

🤖 Helpful? 👍/👎

@mfe mfe changed the title Fixing warnings of 6.4+ due to obsoleted APIs [UUM-137284] Fixing warnings of 6.4+ due to obsoleted APIs Mar 17, 2026
Typo: The function calls were interverted (Request was called in
the #else path so for 6.4 and under)

What stems: ConvertAll is not available in ISearchList (that Request
returns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants