Hi, I am trying out Perspective_And_TopDown_Demo scene. It works as expected in my Windows and Mac editor but when I deploy in ios I can't get the zoom or pan working but the rotation is working. And in the debug I can see message: NullReferenceException: Object reference not set to an instance of an object at Exoa.Common.BaseTouchInput.GetMouseWheelAxis in Exoa.CameraPersBase.Update().
Zoom not working on mobile
- Edited
I have debugged this issue by returning 1 in public static float GetScroll() commenting out the code return 1 - (BaseTouchInput.GetMouseWheelAxis()); after this I can use the controls on mobile and the exception goes away. Wonder what is the proper fix to this issue?
Janna Thanks for reporting, probably because InputSystem.Mouse.current is null on mobile with the new input system. I will fix this upcoming weekend and keep you posted.
You can try to replace the code inside BaseTouchInput.GetMouseWheelAxis() by:
public static float GetMouseWheelAxis()
{
#if ENABLE_INPUT_SYSTEM
return UnityEngine.InputSystem.Mouse.current != null && UnityEngine.InputSystem.Mouse.current.scroll != null ? UnityEngine.InputSystem.Mouse.current.scroll.ReadValue().normalized.y * .1f : 0.0f;
#else
return Input.GetAxis("Mouse ScrollWheel");
#endif
}
return Input.GetAxis("Mouse ScrollWheel");
#endif
}
Same with GetMouseWheelDelta()
public static float GetMouseWheelDelta()
{
#if ENABLE_INPUT_SYSTEM
return UnityEngine.InputSystem.Mouse.current != null && UnityEngine.InputSystem.Mouse.current.scroll != null ? UnityEngine.InputSystem.Mouse.current.scroll.ReadValue().y : 0.0f;
#else
return UnityEngine.Input.mouseScrollDelta.y;
#endif
}
Thanks!