Why i cant use dom element in phaser 3?
error: this.add.dom is not a function
my code: var domElement = this.add.dom(50,50).createFromHTML(“div”);
tks
Why i cant use dom element in phaser 3?
error: this.add.dom is not a function
my code: var domElement = this.add.dom(50,50).createFromHTML(“div”);
tks
DOM game object is under EXPERIMENTAL
tag, which is not released officially yet.
I’m not sure how to compile the dev build from the github repo, but you can save it from the Phaser 3 examples page. You have the option to select any build, and there is an option for the dev build. In fact, the examples won’t work by default, you have to switch it manually.
You can also try to add it manually. See this example.
Would be nice to know before I spent hours trying to figure out what the problem was. If it’s not usable, why is it on the Phaser 3 examples???
DOM game object is released officially already, user dose not have to add any tag for using it. Make sure updating phaser3 to latest version (3.23.0)