Search Issue Tracker
Fixed in 1.1.0.-pre.5
Found in [Package]
[WebGL] Mouse position is not relative to the canvas when using the new input system
There are two issues in this bug report:
This error was seen when calling InputSystem.RegisterBindingComposite function with RuntimeInitializeOnLoadMethod attribute:
"InvalidOperationException while resolving binding 'point:PointerInput' in action map 'PointerControls"
This was occurring not because of a bug, but because the script was missing the [RuntimeInitializeLoadType.BeforeSceneLoad] attribute before calling the register function:
private static void Register()
The documentation was updated to clarify this: https://docs.unity3d.com/Packagesemail@example.com/manual/ActionBindings.html#writing-custom-composites
Once you add that, the error goes away, but then there is a bug in the WebGL new input system code where the mouse position returned was relative to the browser window, and not the Unity canvas.
How to reproduce:
1. Open the attached project
2. Make a WebGL build
3. Host the built WebGL Player locally
4. Open the built Player in a browser
5. Wait for the Player to load
6. Check the Developer Console (shortcut F12)
Expected result: No exceptions are thrown
Actual result: "RuntimeError: memory access out of bounds" error are thrown
Reproducible with: 1.1.0-pre.5 (2021.2.0b4, 2022.1.0a2)
Not reproducible with: 1.1.0-pre.5 (2019.4.29f1, 2020.3.14f1,, 2021.1.15f1) (Player doesn't crash but Input errors are still thrown)
- There are also additional "InvalidOperationException while resolving binding" errors thrown
- Adding a 'RuntimeInitializeLoadType.BeforeSceneLoad' parameter to the RuntimeInitializeOnLoadMethod Attribute used on the Register function (to call InputSystem.RegisterBindingComposite<PointerInputComposite>();) seems to resolve the crash and errors. Function is inside the PointerInput.cs file
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Lists auto expand when scrolling down in the Inspector Window
- Graphics.CopyTexture does not work with Texture2DArray when "Texture Quality" is not "Full Res"
- Unity Download Assistant uses the last install path
- Keycodes Less and Greater are not being registered when using GetKeyDown
- GameObjects in the Scene are not selectable when using "w" after painting with Tile Pallete