Search Issue Tracker
Fixed in 1.1.0.-pre.5
Votes
8
Found in [Package]
1.1.0-pre.5
Issue ID
1347311
Regression
No
[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:
Example:
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
private static void Register()
{
InputSystem.RegisterBindingComposite<PointerInputComposite>();
}
The documentation was updated to clarify this: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.1/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)
Note:
- There are also additional "InvalidOperationException while resolving binding" errors thrown
Workaround:
- 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
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Package signature validation unexpectedly return an invalid signature status if the validation check is done after the code signing certificate validaty range has passed
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
Resolution Note (fix version 1.1.0.-pre.5):
Fixed in 2022.1.0a7
Resolution Note (fix version 1.1.0.-pre.5):
Fixed in 2020.3.29f1
Resolution Note:
Fixed in 2021.1.21f1
Resolution Note:
Fixed in 2021.2.0b12