Object function error when installing the package

Description, details and error message(s)

Just installed coherence to make a multiplayer mode for my game. It installed but gave me this console error:

Library\PackageCache\io.coherence.sdk@1.3.1\Coherence.Editor\Postprocessor.cs(290,28): error CS0117: ‘Object’ does not contain a definition for ‘FindFirstObjectByType’

Expected behaviour

coherence installs without any issues or compiler errors

How to reproduce : Install coherence in Unity 2022.1.1f1

Environment

Unity: 2022.1.1f1
OS/Platform: Windows

I wonder if 2022.1.1f1 does not contain the API for this? I see that it is in 2021.3.18f1 and 2022.2.5f1 though, which are listed as our required versions for their respective releases: Get the Unity SDK | coherence Documentation

My recommendation would be to try 2022.2.5f1 and let us know if that fixes your issue.

1 Like

I think Brit is correct. Seems like the API was introduced exactly in 2022.2.5f1:

API Changes

  • Scripting: Added: Object.FindFirstObjectByType() and Object.FindAnyObjectByType() functions added as potentially faster alternatives to Object.FindObjectOfType(). These new functions let you decide whether you must have the first (lowest InstanceID) object found or if any instance is adequate. In the latter case the function can be many times faster as no internal sorting is required. See the scripting documentation for both functions for more details.