Hello, I am fairly new to PlayCanvas so, please forgive me if I don’t understand something. So, I was trying to make a menu, and once the “Play” button is pressed, it will change the scene to the “Untitled” one. My menu scene is setup like this
2D Screen
├── Text
├── Play (Button)
│ └── Text
└── Camera
There are more entities, they are not important to the problem
I have a script for the button, here is the code
var ButtonController = pc.createScript('buttonController');
// initialize code called once per entity
ButtonController.prototype.initialize = function() {
var scene = this.app.scenes.find('Untitled')
this.entity.button.on('click', function(e) {
pc.Application.loadScene(scene.url)
}, this)
};
// update code called every frame
ButtonController.prototype.update = function(dt) {
};
// uncomment the swap method to enable hot-reloading for this script
// update the method body to copy state from the old instance
// ButtonController.prototype.swap = function(old) { };
// learn more about scripting here:
// https://developer.playcanvas.com/user-manual/scripting/
Yes, I have linked the code in the script component of the button.