Search Issue Tracker

Fixed

Fixed in 6000.4.9f1, 6000.5.0b11, 6000.6.0a6

Votes

0

Found in

6000.4.7f1

6000.5.0b8

6000.6.0a5

Issue ID

UUM-142315

Regression

Yes

“'Object.FindObjectOfType<T>()' is obsolete: 'Object.FindObjectOfType has been deprecated” warning displays incorrect deprecated method replacement

Core Runtime

-

Reproduction steps:
1. Create a new project
2. Import the attached “MobileControlRig.cs” file
3. Observe the script warning in the Console
4. Double-click on the warning to open the script editor and replace “FindObjectOfType” with the suggested method (e.g. “FindFirstObjectByType”)
5. Save changes and return to the Editor
6. Observe the Console

Actual result: 
{code:java}
Assets/MobileControlRig.cs(44,63): warning CS0618: 'Object.FindFirstObjectByType<T>()' is obsolete: 'FindFirstObjectByType has been deprecated because it relies on instance ID ordering. Use FindAnyObjectByType instead, which does not depend on ordering.' {code}
warning is thrown
Expected result: Initial warning suggests the correct replacement method and no other warnings are thrown after applying the change

Reproducible with: 6000.4.0b6, 6000.4.7f1, 6000.5.0b8, 6000.6.0a5
Not reproducible with: 6000.0.75f1, 6000.3.15f1, 6000.4.0b5

Reproduced on: Windows 11, macOS Tahoe 26.4 (M4)

Note:
Full initial warning:
{code:java}
Assets/MobileControlRig.cs(44,63): warning CS0618: 'Object.FindObjectOfType<T>()' is obsolete: 'Object.FindObjectOfType has been deprecated. Use Object.FindFirstObjectByType instead or if finding any instance is acceptable the faster Object.FindAnyObjectByType'
{code}

  1. Resolution Note:

    Fixed in 6000.6.0a6

  2. Resolution Note (fix version 6000.6.0a6):

    Fixed in 6000.6.0a6

  3. Resolution Note (fix version 6000.4.9f1):

    Fixed in 6000.4.9f1

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.