Hello there, new to Phaser (and a bit new to JS). I’m trying to load HTML into my menu scene which I’ll eventually use to customize a few variables in my main scene but running into this console error:
Uncaught TypeError: Cannot read property ‘style’ of undefined
at DOMElementCSSRenderer
I did include the dom object in the game config and I even added the ‘parent’ tag and added a div with id to the index.html but no luck.
let game = new Phaser.Game({
parent: 'phaser-tag',
width: 800,
height: 600,
dom: {
createContainer: true
},
scene:[
LoadScene,
MenuScene,
PlayScene
],
create() {
this.add.image(0,0, CST.IMAGE.TITLE).setOrigin(0).setDepth;
let element = this.add.dom(400, 0).createFromCache(CST.TEXT.INPUT);
inputs.html
<input type="text" name="nameField" placeholder="Enter your name" style="font-size: 32px">
<input type="button" name="playButton" value="Let's Play" style="font-size: 32px">
Any suggestions are appreciated.