Search Unity

Resolved FindObjectsByType and its siblings

Discussion in 'Scripting Dev Blitz Day 2023 - Q&A' started by SurreyMuso, Feb 23, 2023.

  1. SurreyMuso

    SurreyMuso

    Joined:
    Mar 16, 2020
    Posts:
    63
    Rather confused by the absence of xxxByType in my editor, despite it being in the documentation from 2021.3 onwards. FindAnyObjectByType is allegedly faster than OfType but it doesn't seem to exist.

    Furthermore, we are recommended to use xxxByType

    Confused? You will be...
     
    Last edited: Feb 23, 2023
    SF_FrankvHoof likes this.
  2. Maria_Angelova

    Maria_Angelova

    Unity Technologies

    Joined:
    Mar 3, 2020
    Posts:
    29
    Hello.
    FindAnyObjectByType is available in these incremental and later versions of Unity :
    2023.1.0a20
    2022.2.5f1,
    2021.3.18f1
    2020.3.45f1
    If you are using 2021, and update to 2021.3.18f1 or later you should be able to use the faster API.
     
    sdavari and SurreyMuso like this.
  3. SurreyMuso

    SurreyMuso

    Joined:
    Mar 16, 2020
    Posts:
    63
    Thank you, Maria. I'd love to upgrade but I teach at a University and we only upgrade our systems once a year. We're stuck on 2021.3.5 until next August when we'll hopefully go to 2022 LTS. All my teaching materials have to be on the same level as the Uni machines so I do pretty much everything in 2021.3.5, hence not finding xxxByType.

    At home I use 2022.2.0 as well so I'll try bringing that up to date, as you suggest.

    Thank you again - it's terrific finding friendly Unity staff on these forums. Long may you be allowed to do so...
     
    Maria_Angelova likes this.