Is the code for obtaining text available
bowen wang
Posts: 4
const Scene = require('Scene');
const myText = Scene.root.findFirst('myText');
myText.text = "Hello World!";
1
Best Answer
-
Hi Bowen!
If you're trying to edit a Text Component from the Script, you can do this;Add a Screen Text (this creates a Orthographic camera)
Add the Script component to the Orthographic Camera
Click the red area and select the plus icon next to "Search". Select "Script"
Copy this code into the Script
// @input Component.Text text script.text.text = "changed text from code"
Last step is to select your text layer in the Orthographic Camera.
0
Answers
-
Hi @bowen wang,
Are you trying to change the text from a Script?If so:
Create a Script file and add the
Component.Text
input.// @input Component.Text text script.text.text = "changed text from code"
Create a Screen Text like below.
Add a Script to the Orthographic Camera
In the Orthographic Camera, select the Text component you want to update
0