Interacting with Unreal Engine
The Arcware Pixel Streaming WebSDK provides a seamless interface for web applications to interact with Unreal Engine-powered experiences. This interaction is crucial for creating an immersive and interactive user experience, where the actions taken on the web interface can directly affect the game or application running in Unreal Engine.
Overview
The WebSDK facilitates communication between your web-app and the Unreal Engine Application using the WebRTC protocoll. This connection enables the transmission of user inputs from the web to the Unreal Engine, allowing for real-time interaction.
Sending Input to Unreal Engine
To send input to the Unreal Engine, the ArcwareApplication
exposes a method called emitUIInteraction
. This method allows you to send structured data that Unreal Engine can recognize and respond to as if it were native input.
Example: emitUIInteraction
In the above example, Application
is an instance of the ArcwareApplication
class, which encapsulates the streaming and interaction logic. The emitUIInteraction
method takes an object that defines the type of interaction and its payload.
Receiving Responses
The WebSDK also allows you to handle responses from Unreal Engine. When you send an interaction command, Unreal Engine can send back a response that you can capture and handle within your web application.
Handling Application Responses
To handle responses from Unreal Engine, you can use the getApplicationResponse
method provided by the WebSDK. This method sets up a callback function that will be called whenever a response is received.
Example: getApplicationResponse
In this example, any response from Unreal Engine will be logged to the console, and you can add additional logic to handle the response as needed.
Summary
The interaction between your web application and Unreal Engine is a two-way street. You can send commands to Unreal Engine and handle the responses using the emitUIInteraction
and getApplicationResponse
methods, respectively. This powerful feature of the WebSDK opens up a myriad of possibilities for creating interactive and engaging web-based experiences powered by Unreal Engine.
Important Consideration for Developers
Please note that in order for these interaction features to work as expected, corresponding input handlers and response mechanisms must be properly set up on the Unreal Engine side. This typically involves scripting within the Unreal Engine project to define how it should process incoming commands and what responses should be sent back. Without this setup, the WebSDK will not be able to communicate effectively with the Unreal Engine application. For more info how to set up Unreal Engine for this purpose, click on the link below.
Last updated