Forum rules - please read before posting.

Camera loses reference after player/scene switch

Hi all,
I'm trying to implement a "book closeup" scene that gets triggered when the player uses an inventory object. Since I want the scene to get back to the previous state once the book is closed, I created a new player character that stays hidden in the book scene, and when I use the inventory object, I switch players.

It works fine, except for one thing: when I get back to the original player, the main camera loses its reference (the inspector shows "Attached camera: none" instead of my MainCam object) and so it doesn't follow the player anymore.

The MainCam is set as default camera in the scene manager.

In the player switch action when using the book, I ticked "overlay current screen if switch scene", I don't know if it has an influence.

Comments

  • Welcome to the community, @Gugames.

    Yes, that sounds like the right approach - switching Player this way means you can return to the "proper" Player's position when re-entering the scene.

    In order to save which camera is active, though, you'll need to make sure a Constant ID component is attached to the correct GameCamera. You can automate this process via the Settings Manager's Auto-add save components to GameObjects button.

  • Thanks @ChrisIceBox

    Now it works perfectly!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.