Quick question about node.findByTag

I’m working on my Euclidean TRPG Assistant (ETA) (PlayCanvas | HTML5 Game Engine), and I want to reference one of my buttons from another script. I’ve tried giving the button a unique tag (rulerButton) and referencing it by using node.findByTag as specified in

However, when I do this, it throws an error: “Uncaught ReferenceError: node is not defined”. Here is my script for reference:

Note that I’ve also tried findByName(“Ruler_Button”), but it falsely claims that no such name exists.

Any help with this, or advice on an easier way to reference the button, would be greatly appreciated.

Just saw in the console log that it’s referring to the .onSelect function (in the same script). The only reason I could imagine that mattering is line 64, which refers to the rigidBody property. However, I have added both a rigidBody and a collision property to the ruler button.

It goes without saying that this has not resolved the problem.

Hi That_Guy,

If you play the app and then bring up the debug tools ( in the case of Chrome, press F12 ), you get the following screen, showing that node isn’t defined.

I know. I’m asking what that means, and what I can do about it.

Instead of node.findByTag, try this.app.root.findByTag

This should let you get past the current issue.