Built version different from editor

hey everyone
I have a small project with 2 cameras, each attached to an animated fbx.
its possible via scripting to switch between the 2 by pressing the keyboard.
all is fine in the editor, however when I build it, only one camera is attached and the other is just staying put?

hope someone has a lead here is the editor:
https://playcanvas.com/editor/scene/924287

and heres the build:

That is a lot of things to go through to understand your app. Can you make a smallest example, that demonstrates your issue?

im not sure how to do that as I dont know what to elliminiate? I dont know whats causing the issue, so I might be deleting the cause if I downscale.

Basically the camara called “Left” is attached to the entity “head_path”.
it works fine in editor but not in build.

I have the exact same setup for the camera “Camera” which is attached to the entity “camTest”. however that works both in editor AND build…

How do I know that the other camera is not working? What should happen?

the Camera “Left” is following the animated path of the fbx “head_path”.
you dont see it in the EDITOR as it works, but in the BUILD the camera “Left” is not attached to “head_path” anymore.

that is why I linked both edit and build

Yeah, I give up, sorry :slight_smile: Perhaps someone else may want to look into it. My recommendation - when you have a problem - make the smallest possible example project with the issue. If the issue does not repeat in the example, then you will know where to look for the problem. If it repeates - it will be easier for us to identify the issue and advice on the solution.

The size of the project makes it very difficult to debug

It looks like you may have multiple cameras active at the same time? Please only have one active at any point unless you are doing a multi render pass.

I have used the example from your docs on how to switch between 2 cameras. having 1 enabled whilst one is off, so should be fine?

var CameraManager = pc.createScript('cameraManager');

// initialize code called once per entity
CameraManager.prototype.initialize = function() { 
    this.activeCamera = this.entity.findByName('Camera');
    this.app.keyboard.on(pc.input.EVENT_KEYDOWN, this.onKeyDown, this);

};

//prevents default browser actions, such as scrolling when pressing cursor keys
CameraManager.prototype.onKeyDown = function (event) {
    event.event.preventDefault();
};

CameraManager.prototype.setCamera = function (cameraName) {
    // Disable the currently active camera
    this.activeCamera.enabled = false;

    // Enable the newly specified camera
    this.activeCamera = this.entity.findByName(cameraName); 
    this.activeCamera.enabled = true;
};

// update code called every frame
CameraManager.prototype.update = function(dt) {
    var app = this.app;
    
     if (this.app.keyboard.wasPressed(pc.KEY_RIGHT)) {
        this.setCamera('Camera');
    } else if (this.app.keyboard.wasPressed(pc.KEY_LEFT)) {
        this.setCamera('Left');
   
    }
};

There’s an error in the console

Uncaught Error: script name: 'move' is reserved, please change script name
    at Object.e [as createScript] (playcanvas-stable.min.js:1037)
    at __game-scripts.js:1

In the Editor launch tab, all the user created script files are separate files when loaded. If there is an error (which there is), it only stops the execution of the that file so all the other scripts are unaffected.

In a published build, all the scripts that concatenated into one file so an error would stop ALL of your code from working correctly.

To fix this error, rename the script type of move.js (the parameter that is passed into pc.createScript) or delete move.js as you don’t use it.

im at a loss. I tried creating a smaller simpler scene for you guys but now the scripts dont work in that one even though its exactly the same as the other scene.

it just says “Error loading scripts. Open the browser console for details”

Delete move.js from the root of the assets folder