How can I read/write my extension’s scene/global variables?
With help from Copilot I found that you can set and get a function scene variable with
This checks the extension “Mine” for a function scene variable named “Player”
(get, set and check if it exists and returns true or false)
runtimeScene.getVariablesForExtension("Mine").get("Player").setString("Tom")
const q2 = runtimeScene.getVariablesForExtension("Mine").get("Player").getAsString()
const q3 = runtimeScene.getVariablesForExtension("Mine").has("Player")
.
Edit: I belive I found the function global variable. same method different beginning.
const q = runtimeScene.getGame().getVariablesForExtension("Mine").get("Test").getAsString()
It was a bit confusing because these links seemed the same and I can’t alway figuire out the beginning part.
2 Likes