Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug XRI 2.4.0 Compiler Error

Discussion in 'XR Interaction Toolkit and Input' started by KoolGamez, Jun 22, 2023.

  1. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    When I try to import XRI 2.4.0, I get this compiler error: Library\PackageCache\com.unity.xr.interaction.toolkit@2.4.0\Runtime\Utilities\ComponentLocatorUtility.cs(71,39): error CS0117: 'Object' does not contain a definition for 'FindFirstObjectByType'

    I didn't get this error when I was using 2.3.x versions of XRI
     
  2. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    145
    I recommend deleting your package cache in the library folder and trying again. Upgrades can leave behind old versions when you do them manually through the manifest.
     
  3. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    Hi, I tried creating a completely new project and then directly importing XRI v.2.4.0 and still get this error
     
  4. ericprovencher

    ericprovencher

    Unity Technologies

    Joined:
    Dec 17, 2020
    Posts:
    145
    What Unity version are you using?
     
  5. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    Unity 2021.3.12f1 (LTS)
     
  6. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    Initially, I had updated it using the package manager (I didn't do it manually by editing the manifest). That gave this error so I created a brand new 3D core project and imported XRI 2.4.0 from the package manager and still got this error
     
  7. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    Just tried it again by creating another brand new project. Still the same error. The steps I am following are:
    1. create new project from unity hub
    2. go to package manager and add package by name and type: com.unity.xr.interaction.toolkit (I don't mention version so it installs the latest one)
    3. as soon as the XRI package is installed, it gives the error above. Not only that, it says that the Unity Input system package is a dependency for this package but I don't see it when I am in "Packages: In Project". When I change to "Packages: Unity Registry" it shows a green check mark next to the Input system package showing it is installed. But I never got the prompt to restart the editor to enable the new input system backends (as mentioned in the Installation page of XRI documentation).

    I never faced this issue when I was using XRI 2.3.x
     
  8. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    You will need to update your Unity version to a newer patch version for that method to be available.
     
    ericprovencher likes this.
  9. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    Hi. Just downloaded Unity 2022 LTS. It is working now. Thank you!
     
    ericprovencher likes this.
  10. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    I am still getting a weird error. The hands for the XR Device Simulator are both pink (it is not able to find some shader)
    upload_2023-6-23_0-44-26.png
     
  11. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    You need to install the Shader Graph package to your project to fix the pink hands. (You will likely also need to install the XR Hands package and its HandVisualizer sample).

    If you open Edit > Project Settings > XR Plug-in Management > Project Validation, you can see warnings and errors in your project. There should be an issue in there to install Shader Graph and you can click Fix All or Fix to address each issue if it's possible to do it automatically.

    You can also refer to the Samples page in the manual which has some more information about each sample.
     
  12. KoolGamez

    KoolGamez

    Joined:
    Apr 11, 2020
    Posts:
    29
    I have already installed the xr hands package. However, isn't shader graph part of URP? Does this mean I cant use XRI in the built-in render pipeline?
     
  13. VRDave_Unity

    VRDave_Unity

    Unity Technologies

    Joined:
    Nov 19, 2021
    Posts:
    254
    Hey @KoolGamez,
    Shader Graph is not technically a part of URP, so in Unity 2021 you can have it generate shaders that work with built-in render pipeline. XRI can use either built-in or URP, with the samples setup for using built-in RP out of the box. The only caveat is that the Hands Interaction Demo uses a Shader Graph shader that requires multi-pass to be enabled to generate the correct effect. You could opt to use an opaque hand material instead and drop back to single-pass if you prefer.
     
    KoolGamez likes this.
  14. palombo95

    palombo95

    Joined:
    Jun 28, 2023
    Posts:
    1
    Hello, I got an error message in the unity Hub: what might be the reason: Library\PackageCache\com.unity.xr.interaction.toolkit@2.4.0\Runtime\Utilities\ComponentLocatorUtility.cs(31,43): error CS0117: 'Object' does not contain a definition for 'FindFirstObjectByType
     
  15. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    220
    You will need to either:
    • Install the latest patch version of Unity from Hub for the yearly version you are using, and then open the project using that newer version, or
    • Update XRI to 2.4.3, see Installation in the manual. An easy way is browse to your project in file explorer, and edit
      Packages\manifest.json
      in a text editor and replace the version next to
      com.unity.xr.interaction.toolkit
      with
      2.4.3

     
  16. Tufftyboola

    Tufftyboola

    Joined:
    Jan 28, 2021
    Posts:
    5
    Hi, firstly I am not an expert in anyway so I may have missed something simple (including am I in the right Forum, my first post), but I am trying to use Hand Tracking and Motion Controllers on an OpenXR project via Oculus Quest 2.

    My current set up (mostly the "XR Interaction Hands Setup" from XR Interaction Toolkit 2.4.3) is not working as the manual suggests for the component - XR Input Modality Manager held within the XR Origin (XR Rig).

    If I start the runtime with the controllers in my hand they work as I set them up.

    Then when I put the controllers down, my hands appear and work as expected, but when I pick the controllers back up they do not reappear. However the joysticks work in a fashion, but not the grab etc.

    From my days spent trying to find a solution it seems the Motion Controllers Section is not working correctly. I have swopped the Hand prefab with the Controller prefab and I get the same result i.e. whatever is in the Motion Controllers section will only work correct if used on Awake of the project, if it is put down or not used at the start of the project runtime it has the aforementioned outcome.

    I am using:
    2022.3.5,
    XR Hands 1.2.1
    XR Interaction Toolkit 2.4.3
    XR Plugin Management 4.4.0

    Thank you to anyone who can advise, as said I am not an expert but grateful for any help in this matter.

    FYI I have managed to get the Meta Controllers for Hand set up on another project, which seem to work the best so far. So I am hoping that this OpenXR version is going through a developmental teething process and aims to match what Meta is offering via the Oculus Integration Package 55.0
     
  17. davidresolution

    davidresolution

    Joined:
    Apr 29, 2021
    Posts:
    6
    I am having the same issue with the caveat that I can't get the controllers to work/show up with the "HandsDemoScene" and the "XR Interaction Hands Setup". They seem to be correctly setup in the "XR Input Modality Manager" but nothing happens ingame when I try to change from hand tracking to controllers or even when I start the app with controllers.
     

    Attached Files:

  18. davidresolution

    davidresolution

    Joined:
    Apr 29, 2021
    Posts:
    6
    Found the solution after posting this.

    I was using both "Meta Quest Touch Pro Controller Profile" and "Oculus Touch Controller Profile" so the controllers were not being tracked correctly.

    I changed to using only one profile and it now works, independently if I use the Touch Pro or just the Touch.
     

    Attached Files:

  19. Tufftyboola

    Tufftyboola

    Joined:
    Jan 28, 2021
    Posts:
    5

    Glad you have a resolution.

    Unfortunately, my project never had this set up. I only have Oculus Touch Controller Profile on PC/Android Tabs.

    Screenshot 2023-07-26 at 13.30.44.png Screenshot 2023-07-26 at 13.30.24.png

    I will keep looking, if your hands/controllers are working regardless wether you are using hands/controllers and can swop multiple times then that gives me hope. I must be missing something :)

    Thanks again and good luck with your project.
     
  20. Tufftyboola

    Tufftyboola

    Joined:
    Jan 28, 2021
    Posts:
    5

    It looks like my issue is resolved.

    I added my Controller Prefab to the XRI Default Left/Right Controller in the XR Interaction Toolkit, helded within the XR Controller (Action-based) component.

    Screenshot 2023-07-26 at 14.36.29.png

    Now I can change between hands and controllers.