Registering Events
The YOM SDK allows you to create and listen for your own custom events, allowing communication between the Unreal client and the pixel streamer /web browser. This guide explains how to set up and use them.
Step 1: Access YOMPlayer
To use Push Events, first access the YOMPlayer. Via standard Unreal method:
Get the PlayerController
Cast it to YOMPlayer
Store the result if needed
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FT7sVprHjsGBYsbWZ6YEn%252Fimage.png%3Falt%3Dmedia%26token%3Dbd318cde-6ea5-415d-a3c3-e763435fa5b3&width=768&dpr=4&quality=100&sign=2d6eeb57&sv=1)
Or, using GetYomPlayer function directly:
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FDLSjb5JgfpPmeNmYsRjJ%252Fimage.png%3Falt%3Dmedia%26token%3D04db901f-590d-4ae6-b5d6-486603e69bc0&width=768&dpr=4&quality=100&sign=b833ed30&sv=1)
Step 2: Register a Stream Event
Once you have the YomPlayer, register a stream event:
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FjO7ZFzTawEHYNHRuRxQT%252Fimage.png%3Falt%3Dmedia%26token%3D1c3580e4-4d81-4dcd-a9e4-8c37d9992de0&width=768&dpr=4&quality=100&sign=8154b3aa&sv=1)
Set PFunctionName:
Name of the function to call
Will be displayed in the "GodMode" modal when enabled
Used to call the linked event
Set PEvent:
Event to be called when the function named PFunctionName is triggered
Set PNeedsGodMode:
Determines if the event is added to GodMode
Use for admin-only functions (GodMode requires a password)
Create the event:
Drag from PEvent and search for "create event"
Select "Create Event" node
Choose "select a function" and pick from the dropdown or create a new one
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FdRpE02vBpJkxyPst6Bu9%252Fimage.png%3Falt%3Dmedia%26token%3D907e1993-3d40-4330-bcf7-aa1928a64d48&width=768&dpr=4&quality=100&sign=407efe6c&sv=1)
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FUzh0oYmf1bkMa8E1qaf3%252Fimage.png%3Falt%3Dmedia%26token%3D19869eff-5a12-4033-bea3-8bf2d4d50ab8&width=768&dpr=4&quality=100&sign=9713df5c&sv=1)
Note: The function input will be a Va Rest Json object, allowing data to be sent with the event.
Step 3: Handling Event Callback
To process data that is sent with the event:
![](https://docs.yom.ooo/~gitbook/image?url=https%3A%2F%2F592901951-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FtYMdrQa2NEmUrirelU3a%252Fuploads%252FF7Vjri9WAyxE69ChpnrB%252Fimage.png%3Falt%3Dmedia%26token%3De4dc077e-27ab-4685-b96d-4dd4c94a9340&width=768&dpr=4&quality=100&sign=18bfb24c&sv=1)
Access the data object passed to the function
Use "get field by name and type" to retrieve specific variables
Implement your logic using the retrieved data
Last updated