Solved(by QC) Get text input from nodes via TextInput canvas element. How does it work?

I simply tried to input text via canvas and read it via Get Canvas Input Text. Why does it not work for me?


See Blend.
Mighty_def_cube.blend (1.1 MB)

Can anybody help, please?

Hi, it seems to a bug or a missing function. The canvas traits seem to work only when they are applied on the Scene and not on Objects. The main reason being this:

Scene.active.getTrait(CanvasScript);

So only canvas traits attached to Scenes work. But the existence of “UI Trait” option for Object is misleading.

Workaround: Use one Scene Canvas Trait for everything(at least for logic nodes).

2 Likes

Also see https://github.com/armory3d/armory/issues/1842#issuecomment-689834549, it will also work if your object is the active camera since that’s what the logic node is querying (in addition to the active scene):

It’s definitely something that could be designed better, either by restricting canvases to scenes (3D canvases should still be possible I think) or by adding an optional “Object” field for example that will search for a canvas on the given object. For multiple canvas nodes this could perhaps be outsourced to a new “Get Canvas” node.

2 Likes