what are the codes and where should i put it if i want to make a switch between two cameras? can anyone help?
To switch between two cameras the idea is to disable the active one, and enable the other.
Here is some example code using entity names to find the entities in the hierarchy, enable Camera2 and disable Camera1:
const camera1 = this.app.root.findByName('Camera 1'); camera1.enabled = false; const camera2 = this.app.root.findByName('Camera 2'); camera1.enabled = true;
There is even a official PlayCanvas tutorial on toggling active camera views: