UI Layer Scripts

Available Elements

The available elements to work with using the scripting language are as below:


The entity object holds data related to the entity the script is attached to. This will follow the standard structure of the scene objects but there will be different fields depending on what the script is attached to.

  id: '<string>',
  type: '<string>',
  attributes: {
    title: '<string>',
    scene_id: '<uuid>',


The memory object allows you to store data which is shared between the engine and the 2D UI layer. More info in the memory page


Gives access to the events framework within the 2D layer that allows you to open/close pages, switch to other applications or load scenes.


Allows you to send messages to the 3D engine. Should not be used at the moment as the framework around it has not yet been built, but will be expanded in future.

Opening internal pages

You can open internal pages using the Page ID found in the CMS

events.publish('openPage', <page_id>);

If you want to close all pages instead, you can using the event:


Opening external pages

External pages will be opened in a new window so the Plattar context is not lost. To do this we make a call to the ‘Plattar Bridge’ which bridges communication across the app layers.

bridge.sendMessage('tuiopenexternalurl', {url: <external_url>});

Displaying data in pages

The Plattar page objects will automatically refresh themselves, resetting their state the whatever was set in the CMS. For this reason it is recommended that you use the HTML card to write you own HTML elements that you can modify with scripts.

// Get an element and change it's colour
var elem = document.querySelector(<selector>);  
elem.style.color = 'red';`

// Get a list of elements and change their colour
var elems = document.querySelectorAll(<selector>); 
  el.style.color = 'red';