O
OneJS2y ago
Singtaa

> incorporate script changes at runtime

incorporate script changes at runtime
Not sure if I'm getting the question correctly. Do you mean to execute some JS code string at runtime from Preact? If so, here's an example: Expose the ScriptEngine to your JS land:
No description
2 Replies
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Singtaa
SingtaaOP16mo ago
You need to use "pure" JS if directly feeding to Jint:
importNamespace("UnityEngine").GameObject.CreatePrimitive(0)
importNamespace("UnityEngine").GameObject.CreatePrimitive(0)
or something like:
var { GameObject, MeshRenderer, Color } = importNamespace("UnityEngine")

var sphere = GameObject.CreatePrimitive(0)
sphere.GetComponent(MeshRenderer).material.color = Color.red
var { GameObject, MeshRenderer, Color } = importNamespace("UnityEngine")

var sphere = GameObject.CreatePrimitive(0)
sphere.GetComponent(MeshRenderer).material.color = Color.red

Did you find this page helpful?