I saw your example on how to communicate with external scripts. Is there a way to create custom events apart from “loadingStarted” “loadingProgress” and “loadingFinished” which other systems on the website can listen to? E.g. I wanna click a button in needle and some div element on the website should change color.
Already tried something like this but does not seem to work.
and then import it in your script (make sure its a module)
import { MyComponent } from "your/package"
Alternatively get the context from the engine-element (see docs)
and then query for the component you are interested in:
async function init() {
const ctx = await engine_component.getContext();
const myComponentInstances = GameObject.findObjectsOfType(MyComponent, ctx)
// do what you need
Hmm, calling the “activateOverlay” function in the needle script from the external script works (line 12), but when I’m calling “activateOverlay” from the UnityButton, “onOverlayActivated” is not defined. I’m missing something.