Push Button Example in XR Interaction Toolkit Start Assets DemoScene missing a script.

Hi all,

I am try to understand the push button implementation in the XR Interaction Toolkit example 2.5.4. I am using unity editor 2022.3.33f1.

As I opened the DemoScene in the “Start Assets”, I saw the push button example.

But the “Push Button” missing a script, as shown in the screenshot,

so I step into the “push button” prefab, I find out, it is this file: “XRPokeFollowAffordance.cs”. But in the scene, the push button can not find this file, though this file existed in the path. When I try to add the file, it popup the error:


Can’t add script

Can’t add script component ‘XRPokeFollowAffordance’ because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.

So, why??? The console also didn’t show me any error in this script. Do you have also the same problem like me? Is it a bug?

You should try closing the editor, opening the library folder in your project on the file explorer. Then find the package cache, and finally delete that folder.

Open up the editor again and give it a go.

Hi @ericprovencher , thanks for the suggestion. I tried several times, but it still doesn’t work, the same result. (I am using mac os intel version.)

What I have done is:

  • close the unity editor.
  • goto projectfolder/Library/PackageCache/com.unity.xr.interaction.toolkit@2.5.4, delete this folder
  • restart unity editor.
  • when I restart the unity editor, it ask me to enter the “save mode”, because there is a compile error. I rejected it and go into the normal mode.
  • This time the push button missing all three scripts from “xr interactive toolkit”, so I have to reinstall this package from package manager.
  • The result is two of the files are found, but the third file, “XRPokeFollowAffordance.cs” is still missing.

So nothing changed…Did I do something wrong?

@ericprovencher

A small update.

I started a new project, then everything works fine. I guess, why this happens, maybe I follow the unity vr development tutorial on the learn.unity.com. I start the project from template Create-with-VR_2022LTS, then added another package VR-Pathway_Escape-Room_Assets.unitypackage, the xr interaction toolkit plugin and startassets is outdated, then I updated and reimported them from package manager window. So maybe this cause the conflict between the old version and new version in the cache. I have no idea, is it the real reason, I can currently not reproduce it. But this is what I guess. Anyway, if I start a new project, everything is fine at moment…

I don’t think, this problem should as solved mark, because, give up the project, which people have worked a lot on, is not a gut solution…

@ericprovencher

a new update:

As I make a new project with the course supplied VR Template and the package VR-Pathway_Escape-Room_Assets.unitypackage, the first time everything works fine.

But after I close it and open it some times late, the same mysterious problem happened again. The unity editor can not find this script again.

So I guess is there maybe some conflict happens between the course templates and the xr interaction toolkit package during the update process.

Now, I only delete the library cache is not enough, so I only left the three folders “Assets”, “Packages” and “ProjectSettings” exist and delete all other files. Restart, then everything works fine. I am not sure, whether this mysterious problem will happen again, I will just continue to test.

I had the same problem with the XR Interaction Toolkit 3.0.5. Solved it by following:

  1. Removed the Samples folder
  2. Deleted package cash folder ( that also led to the safety mode on the next Unity project launch)
  3. Removed the XR Interaction Toolkit package from the project
  4. Closed Unity
  5. Reopened project in Unity
  6. Re-imported the XR Interaction Toolkit package and Samples

That solved it.

2 Likes