Setting pointer emulation from GDScript

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By 1234ab

So can I change input_devices/pointing/emulate_touch_from_mouse (or mouse from touch) at runtime (via code)? I tried
ProjectSettings.set("input_devices/pointing/emulate_touch_from_mouse", true)
but I think it isn’t intended to work this way as it didn’t work.

:bust_in_silhouette: Reply From: Zylann

Internally, InputDefault (the base implementation of Input) has a setter for emulate_touch_from_mouse. However it’s not exposed, and I don’t know if setting it dynamically during the game is expected to work.
It’s only assigned when the game starts by reading the project setting.

Maybe when it was added, it wasn’t expected for a game on some device to dynamically stop using touch and using a mouse, or vice versa?

Thanks for your answer! It’s not important for my project, I was just curious. I would have used it for my “use touch input” option, to allow scrolling a scrollcontainer with mouse if the option is set (but only when the option is set) (Clicking button inside ScrollContainer using touch - Archive - Godot Forum), as I’m able to scroll using touch.

1234ab | 2020-04-08 09:09

:bust_in_silhouette: Reply From: Calinou

Toggling mouse/touch emulation at runtime isn’t supported yet, see Multitouch AND mouse menulation for menus - Archive - Godot Forum.