Adding JavaScript code

You can use external JavaScript libraries or write your own JavaScript code to add advanced functionality to your UI.

There are a couple of basic steps that you need to follow in order to add JavaScript code

  1. Create new JavaScript file or copy existing one to the your project
  2. Import the file in the Coherent Editor

Create new JavaScript files or copy existing ones

If you are using the UE4 version of the editor to create a JavaScript file you just need to right click in the UE4's content browser and choose for the menu JavaScript file

Or if you already have a JavaScript file or Library that you want to use then just copy it to the UE4 project's uiresources folder.

If you are using the Standalone version of the editor you can create or copy your JavaScript files in the project's uiresources folder.

Import the JavaScript file in the Coherent Editor

To import the file in the Coherent Editor use the Files panel and click to "+" sign under the Script files section. You can select the JavaScript file form the "pick asset" window (in UE4) or the select file window (for Standalone Editor) that pops up.

If you wish to remove the imported file you can click the "x" icon next to it.

Once you've added the external JavaScript library/file you can use it in the scene's events or element's events code. For more information please check the Events section.