Forum rules - please read before posting.

Camera on player prefab

Hi there,

I have a question. What is the best way to be able to switch to a camera during gameplay that is a part of the player prefab?
I included a simple game camera within the player prefab because I'd like to switch to the player's face close-up camera often. Before playing the game I delete my local player prefab because it will be teleported into my scene automatically through the settingsmanager whener the game is started.
The thing is I cannot pre determine to switch to a game camera that will be present within the scene in the "future", when the player prefab is loaded into the scene.
I can only switch to the local variant of the camera within my player prefab, but this copy gets deleted I suppose and will be replaced by the default player.

What is the best way to get the desired effect?
Thanks!

Comments

  • You don't actually have to delete your local player - if there's on already present in the scene when the game starts, then the one listed in your Settings Manager will be ignored for that scene.

    Alternatively, scene-based Actions can also reference asset-based files - so long as you can select them directly in your Project window.  So, if you have your Camera as an immediate child of your Player prefab, then dragging that camera into your Camera: Switch Action's New camera field will still be possible - you'll see that it records a Constant ID number that it will use to find the camera once it is loaded into the scene.
  • Okay I found the problem I was experiencing. Within the player prefab I made One empty "parent" game object for all my player camera's. I got rid of the parent and now I have all my camera's directly set up as a child of the player prefab.

    Thanks Chris, now it works just like you explained!
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.