How can I enable native touch events?
Prerequisites
- A PureWeb React web client template using SDK version 4.0 or later
(You can get version 4.2.0 of the PureWeb SDK here.) - Make sure your 3D project is properly set up to accept and process all native touch events from mobile devices.
Please note that it is the responsibility of the game developer to implement functionality within the game side to act on the touch events, (for example: to implement pinch zoom using touch events from two fingers).
Touch Events
Native and translated touch events are both supported for Unreal projects.
Touch events for Unity are translated only.
Translated means that touch events get translated to mouse input; native means that the touch events are passed through to the game from the web client.
By default touch events are set to translated, but you can enable native touch events by following the steps below.
Add a UseNativeTouchEvents Parameter
In the App.tsx file of your web client. Go to the VideoStream section around line 170. Inside there, you'll find a line that reads:
useNativeTouchEvents={props.UseNativeTouchEvents}
useNativeTouchEvents is false by default, but we can set it to true in our configuration. Open the client.json file of your React web client, and add the following parameter:
"useNativeTouchEvents":true
Make sure you add a comma to the end of the line preceding this addition!
Passing Properties via URL
You can also pass useNativeTouchEvents as a property into your web application via a URL parameter:
https://your-url.com?useNativeTouchEvents=true
With one of these techniques, you'll be able to run your Unreal stream on a Android phones, iPads, and iPhones with native touch events enabled.