Hello I need help for my pause menu.
If I press ESC key the mouse only shows up first (maybe because of the FPS Controller)
But if I press the ESC key again the pause menu shows up.
And if I press the ESC key again after that, the pause menu does not show up.
Here’s the Script I made:
var Pause = pc.createScript('pause');
// initialize code called once per entity
Pause.prototype.initialize = function() {
this.entity.root.findByName('Pause menu').enabled = false;
};
// update code called every frame
Pause.prototype.update = function(dt) {
if (this.app.keyboard.wasPressed(pc.KEY_ESCAPE)){
this.entity.root.findByName('Pause menu').enabled = true;
this.app.timeScale = 0;
}
};
And here’s the project link:
https://playcanvas.com/editor/scene/1747137
I only applied this Pause Menu at Scene Level 1 first to test