0

So, I'm trying to get the position of some text in 8th wall and it keeps erroring as "null" but when I log the same thing in aframe it works just fine.

Aframe HTML & JS

//-- HTML
<a-text id="text" value="This my text" position="-1.5 4 -5" color="#000" scale="1.5 1.5 1.5"></a-text>

//-- JS
const text = document.querySelector('#text');
console.log(text)

8th Wall HTML & JS

//-- HTML
<a-text id="text" value="This my text" position="0 0 0" color="#000" scale=".4 .4 .4"</a-text>


//-- JS
const text = document.querySelector('#text');
console.log(text)

Aframe gives me

<a-text id="text" value="This is how text works!" position="-1.5 4 -5" color="#000" scale="1.5 1.5 1.5">

with a drop down of more info, but 8th wall gives me this

▼ Uncaught TypeError: Cannot read property 'getAttribute' of null at Object. app.js:15:26 at webpack_require bootstrap at (anonymous) bootstrap at (anonymous) dist_b10037af710deed478c4f4e425bebc2509497cc1-8e90da767df8e9b631034f88b9b150fc_bundle.js

4

1 に答える 1