slick-ui
slick-ui copied to clipboard
can't add "Panel"
Hi,
this is a piece of my code.
//== PRELOAD STATE
...
preload() {
//== SlickUi
slickUI = Game.plugins.add(Phaser.Plugin.SlickUI);
slickUI.load(kenney.json');
}
...
//**
* MENU STATE
* the "Preload State" call the "Menu State" where i create the "Panel" element.
* "_G.SLICKUI" is a global variable
*/
...
create() {
let panel;
console.log(SlickUI.Element); // ==> 'Undefined'
_G.SLICKUI.add(panel = SlickUI.Element.Panel(8, 8, 150, 16)); // ==> Cannot read property 'Panel' of undefined
}
...
I can't figure out how to solve it.
If call SlickUI.Element.Panel in the console it returns a function (so it should work), but return Undefined if called inside create() method