Controller losing tracking when it goes to sleep

Give us as much detail as possible regarding the issue you're experiencing.

ML2 OS version:
B3E.421107.02-R.006

Error messages from logs (syntax-highlighting is supported via Markdown):
none

With one of our devices, the controller works fine when we first turn on the device, but if we take off the device and leave it running for a little bit then put it back on, the controller no longer tracks. It's still connected to the headset because the system button will still pull up the OS menu. But the tracking will not work again until restarting the device. We can turn the controller on and off, re-pairing it, and even wiping the device and re-installing the OS. When the controller starts back up i notice the Initializing screen going for a long time, but when it goes away, there's still no tracking in the device. The hand tracking does work in the OS menu but obviously not in every app.

Oh wait. If my app is running in the background it continues to fail. But if I hardclose the app and wait a few seconds, it can recover. So somethign in the unity input setup is clearly holding on to it. \

A few questions:

Are you noticing it in the Unity Examples?
Are you using OpenXR inside your application?
Are you using the default Magic Leap Rig Prefab that can be imported by the samples?
Do you have both the Hand Interaction and Controller Profiles enabled in the Unity OpenXR Settings

Unity examples: yes
OpenXR: yes
Rig prefab: yes
Both hand tracking and controller in OpenXR: yes

In logcat I'm getting this error:

2024/12/31 22:40:17.154 9618 9638 Error Unity InvalidOperationException: Cannot read value of type 'Vector2' from control '/MagicLeapControllerOpenXR1/pointerPosition' bound to action 'Controller/PointerPosition[/MagicLeapControllerOpenXR1/pointerPosition]' (control is a 'Vector3Control' with value type 'Vector3')
2024/12/31 22:40:17.154 9618 9638 Error Unity at UnityEngine.InputSystem.InputActionState.ReadValue[TValue] (System.Int32 bindingIndex, System.Int32 controlIndex, System.Boolean ignoreComposites) [0x00000] in <00000000000000000000000000000000>:0
2024/12/31 22:40:17.154 9618 9638 Error Unity at UnityEngine.XR.Interaction.Toolkit.UI.XRUIInputModule.ProcessMouse () [0x00000] in <00000000000000000000000000000000>:0
2024/12/31 22:40:17.154 9618 9638 Error Unity at UnityEngine.XR.Interaction.Toolkit.UI.XRUIInputModule.DoProcess () [0x00000] in <00000000000000000000000000000000>:0

It got weirder. I tried turning off hand tracking at the OS level to see if that was related to my troubles. After doing so, the controller isn't disappearing in the app, like it was. Now it's tracking 3DOF. So wherever the controller is when the app starts, that's where it stays. But the direction continues to update. This difference started immediately after turning off hand tracking in the device.

Of course I need to turn it back on now, because without hand tracking, the device is unusable until a reboot. Since the controller continues to fail outside of the app.

Note: I prevented the problem from the above logcat error and it didn't solve the problem. Are there different logs that would better help us diagnose? This is the last issue holding back this app release so I'm eager to solve it.

When did you see this issue begin to occur? After updating SDK Packages or editor versions?

Have you tried reimporting the Magic Leap Input Action Asset and regenerating the C# scripts? I find it interesting because I could not find the following references MagicLeapControllerOpenXR1 in the Magic Leap Example Project

Have you tried disabling the eye interaction profile and eye gaze OpenXR feature in the OpenXR settings?

Do you know how we could reproduce the issue starting from the Magic Leap Example Project?

Can you verify that your package versions match the packages inside the Magic Leap Examples Project?

Do the controller example scripts work correctly? What about in a new scene without the XRUIInputModule ?

I first noticed it pretty soon after updating the Magic Leap SDK in my Unity project. We weren't fully on the new OpenXR stuff before but upgraded for the pixel sensor api.
Clarification: when I said yes to it happening with unity examples, I meant with the samples in the SDK. But that was all within my same project. I'll grab the example project and run tests on that.

Okay, let me know. Based on the logs it looks Ike there might be a mismatch between the input action and the path that it is referencing. It could also be a result of a mismatch of one of the Unity packages from the package manager.

The first warning flag I'm getting in this test is how big a downgrade my editor version is compared with the unity example project I get through the hub. While the docs say 2022.3 is fine, the example is 6000. There's bound to be trouble downgrading that far. Is there a tested and reliable version of the example project in an earlier editor version I can access?

You can use the 2022.3.42f version of the Unity Editor. This editor was used for the 2.5.0 version of the Magic Leap Unity SDK

Yeah builds are failing after the editor version downgrade.

Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
Errors during XML parse:
Additionally, the fallback loader failed to parse the XML.
Errors during XML parse:
Additionally, the fallback loader failed to parse the XML.
Checking the license for package Android SDK Platform 30 in C:\Program Files\Unity\Hub\Editor\2022.3.22f1\Editor\Data\PlaybackEngines\AndroidPlayer\SDK\licenses
License for package Android SDK Platform 30 accepted.
Preparing "Install Android SDK Platform 30 (revision: 3)".
Warning: Failed to read or create install properties file.

UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

It would be very helpful to have a reliable project to pull from in the same Unity Editor version I'm using.

So the latest Unity SDK uses Unity 6 but if you want to downgrade you will need to reinstall the Android SDK.

  • Open the Unity Hub and go to the Preferences.
  • Ensure the Android module is correctly installed for your Unity version.

** If it is installed you may need to delete Delete the Temp, Library, and obj folders from your project directory

You could also try to run the following to inspect the Gradle status:

gradlew --status

Or stop gradle

gradlew --stop

If you continue running into issues, you may choose to use version 2.5.0 of the SDK as a base. Note the following changes were made between 2.5.0 and 2.6.0

### Bugfixes

* Fixed XRSessionSubsystem TrackingState reporting.
* Fixed an issue with `MLVoiceIntentsConfiguration` where there was a potential for a null reference.
* Fixed incorrect enum value for `MLWebview.Keycode.Return`

### Features

* Update to OpenXR SDK 1.1.41 and promote several Magic Leap 2 OpenXR Features out of experimental status.
* Updated `MLVoiceIntentsConfiguration` to no longer require its' lists to be initialized when the ScriptableObject is created through code.

### Misc.

* Changed the underlying numeric type for `PixelSensorAutoExposureMode` so that it can be serialized by Unity.

Where am I supposed to run gradlew --status? It's not recognized in a basic terminal.

Ok, so downgrading the Unity Sample Project fails to build with the above error. So I tried following the docs step by step from Configure Project Settings | MagicLeap Developer Documentation in a fresh project. That one fails to build with the following familiar error:

Building Library\Bee\artifacts\Android\hu7xe\ki9kj7rgnste.o failed with output:
PLEASE submit a bug report to Issues ยท android/ndk ยท GitHub and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: "C:/Program Files/Unity/Hub/Editor/2022.3.22f1/Editor/Data/PlaybackEngines/AndroidPlayer/NDK/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++" -mtune=skylake -m64 -msse4.2 -mfpmath=sse -D__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__ -faddrsig -mllvm -hoist-common-insts=1 -DANDROID -DHAVE_INTTYPES_H -no-canonical-prefixes -funwind-tables -fstack-protector -fomit-frame-pointer -std=c++11 -Wswitch -Wno-trigraphs -Wno-tautological-compare -Wno-invalid-offsetof -Wno-implicitly-unsigned-literal -Wno-integer-overflow -Wno-shift-negative-value -Wno-unknown-attributes -Wno-implicit-function-declaration -Wno-null-conversion -Wno-missing-declarations -Wno-unused-value -Wno-pragma-once-outside-header -fvisibility=hidden -msse2 -mcx16 -fexceptions -fno-rtti -g -Os -fPIC -fno-strict-overflow -ffunction-sections -fdata-sections -fmessage-length=0 -pipe -D_GLIBCXX_USE_CXX11_ABI=0 -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DIL2CPP_MONO_DEBUGGER_DISABLED -DRUNTIME_IL2CPP -DIL2CPP_ENABLE_WRITE_BARRIERS=1 -DIL2CPP_INCREMENTAL_TIME_SLICE=3 -DHAVE_BDWGC_GC -DNDEBUG -I.

similar to Build failure with update . In that case, in my primary project, the problem was fixed after deleting NDK folders outside my project. But now this fresh clean project using the same editor version on the same machine is failing to build. This is just exactly me following the directions on the docs. And I'm hesitant to make any environmental changes because right now my main project is actually building successfully, just with a messed up controller. There must be a way to get a fully working project in Unity 2022.3 like the instructions say.

Unfortunately it looks like the last error is related to a bug from the NDK, you can try deleting the library folder and attempting to rebuild . You can also file a bug at the url that is in the log.

โ€”-

Regarding the other issue, it might be related to the issues you are having with the NDK so you may need to reach out to Unity or the NDK github.

You may want to try using Unity Cloud Build or another build pipeline to build the app in a clean environment.

โ€”

Regarding the issue with the Unity Inout Action Asset. Could you try to reproduce the error in a clean project using the following Unity editor and SDK package ?

2022.3.42f and SDK 2.5.0 or 2.6.0?

Or possibly try using a clean build environment that does not run into the bug with the Unity Editor and NDK.

I have the same problem. I bought Magic Leap a month ago. Controller very frequently goes off, not working anymore, no way, until Magic Leap is restarted. This happens extremely frequent. I am using Unity apps. Controller works in Unity Applications all the time, never have a problem, even several times they are restarted. But when you close the application, main menu of Magic Leap does not work with controller, controller is not tracked, and I have to use hands only.

I think you might be experiencing a separate issue, do you mind creating a separate topic and provide information about your OS version and a bug report if possible?