Hi! The script work amazing on PC, everything (all gamepad, keyboard, buttons, etc) but when I run my game on mobile, I have this error and I don't know how to fix it. (I have the last AC and the script from the wiki community)
https://adventure-creator.fandom.com/wiki/Input_System_integration
(I have direct movement. I use a virtual gamepad)
NullReferenceException: Object reference not set to an instance of an object
AC.InputSystemIntegration.Custom_MousePosition (System.Boolean cursorIsLocked) (at <7937ef364f124b66a741c082746b1a41>:0)
AC.PlayerInput.InputMousePosition (System.Boolean _cursorIsLocked) (at :0)
AC.PlayerInput.UpdateInput () (at :0)
AC.StateHandler.Update () (at :0)
Thanks in advance,
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
For now I just comment some lines in the Input system integration and it work, but i know that is not the correct solution
in Custom_MousePosition
return Vector2.zero;
//return Mouse.current.position.ReadValue();
and
Custom_GetMouseButton
case 0:
return false;
//return Mouse.current.leftButton.isPressed;
case 1:
return false;
//return Mouse.current.rightButton.isPressed;
and the same in
Custom_GetMouseButtonDown
IT work for me , but I don't know how to solve the null object to Mouse.current
Are you getting this error in the Editor, or a build?
If you're in a build, the mouse input functions should not be called if your game's "Input method" is set to "Touch Screen".
There's no problem changing the script in the way you have, however - it should be treated as a sample script to use as a basis for your own needs.