XRControllerFollow script breaks when opening Unity

XRControllerFollow script works fine until you:

  • Close Unity (After its been working)
  • Open Unity
  • In the Unity inspector the script gets grayed out and just says (script) and the follow stops working

The script component can be re-set up and it works. but if you close and save Unity it breaks again.

Console is getting

connect ETIMEDOUT 104.xx.xx.xxx:xxx
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()```

Needle Engine 4.2.4
Unity 2022.3.38f

Hello Cartesius,

It seems you’re experiencing an issue with the XRControllerFollow script becoming grayed out in Unity after reopening the project. This usually indicates that Unity cannot find the script due to potential modifications or changes in the project files.

Troubleshooting Steps:

  1. Check Script References: Ensure that the script file is present in the project directory and not renamed. Unity may lose reference links if the files are relocated or renamed.

  2. Reimport All Assets: In Unity, go to Assets > Reimport All. This may help Unity recognize the script components again.

  3. Script Compilation Errors: Look for any compilation errors in the console that could prevent Unity from recognizing the script.

  4. Script Execution Order: Check if the script execution order affects the component’s behavior. Sometimes dependencies may require adjustments.

  5. Update Needle Engine: As you are using version 4.2.4, consider checking for newer versions or patches that may address this specific issue.

  6. Resave the Script: Sometimes just opening the script and saving it again in the IDE can help Unity re-link it.

Code Check:

Based on the XRControllerFollow implementation, verify that the code itself adheres to the expected interface. Here’s a relevant portion you may want to inspect:

onUpdateXR(args: NeedleXREventArgs): void {
    if (!this.enabled) return;
    const ctrl = args.xr.getController(this.side);
    if (ctrl) {
        this.gameObject.visible = true;
        // Additional position/quaternion updates
    }
}

Final Note:

If none of these steps resolve the issue, please consider providing the output of the console log or examining the project settings that might impact script recognition.

For further guidance, you can refer to the documentation on the API to ensure your implementation aligns with any updates or changes: Needle Engine API.

Let me know if you need any more specific assistance or if there’s something specific you’d like to explore!

1 replies left - Get a PRO license for more AI replies.
thread_bt2fti9cGi9pHkCz2cu6tk7d
Reply to this message to continue the conversation

Hi, this looks like you have a compiler error in unity somewhere in your project OR you somehow have two Unity components called XRControllerFollow.

Dosent Seem like there is a duplicate component XRControllerFollow.

Something i realized i left out →
Export Info object is always disabled when i open up Unity after step two

Our plugin doesnt change the enabled state of components anywhere.

Which Unity version are you using?

Unity 2022.3.38f
Well, It stopped happening and now is resolved since upgrading to the latest needle package - 4.3.0 alpha-2

But now text is not rendering anymore. Also in the text sample.