Game <--> Browser Communication

circle-exclamation

You can send messages from the game to the browser and back using JSON communication.

This guide assumes you've followed Setup the browser widget. The example will use In-world browser as the example.

Communication with a viewport browser is the same except for where the difference is specified.

Sending a message from the browser to the game

We'll add a feature that on clicking a button in the browser, we'll print the text input provided in the browser in the game client.

Sending a message from the game to the browser

We'll add a feature that will display the player's XYZ position in the browser.

First, make a blueprint structure called SPosition with the parameters X Y Z. We'll use this to serialize the vector into a JSON struct.

In your browser widget blueprint, add the following nodes. This will call the function setPlayerPosition in the browser every tick alongside the player's location as a struct.

spinner

In the index.html, update the code to the below.

Last updated

Was this helpful?