I’m trying to retrieve the id of a button created on PlayCanvas in the build with my script, to be able to do an action on click, but I can’t, I don’t understand why.
I have take this project for testing : HTML/CSS UI | Learn PlayCanvas
And i have a simple script who just get the Id aha
var elem = document.getElementById('btn'); console.log(elem)
but it doesn’t work.
However, when I try in the console, I recover the id of my button
Same when i use document.getElementsByClassName.