Forum rules - please read before posting.

Cameras - couple of questions

edited November 2018 in Technical Q&A
Unity ver: 2018.2.2f1
AC ver: 1.65.1

Hey hey,

I've just setup a 2nd scene complete with transistion in my game, and with it I have a couple of questions about cameras: 

1) At the moment I have a Main Camera in each scene (as shown below). Is this the correct way to handle things or should I be using a camera prefab that carries across scenes?

2) When the transistion occurs (and only when the transition occurs) the Unity console is logging an error which says "MainCamera has no MainCamera component".

At this point both my scene files have a main camera which looks like this:


What would I need to do to resolve this error?


Thanks!

Comments

  • 1. A local MainCamera should be used in each scene.  It can be a prefab, but each scene should have its own copy.

    2. That error should only display if you have some other GameObject tagged as MainCamera as well.  If you open MultiSceneChecker.cs, and replace:

    ACDebug.LogError ("MainCamera has no MainCamera component.");

    with:

    ACDebug.LogError ("MainCamera has no MainCamera component.", taggedMainCamera);

    Then clicking the error in the Console when it appears should ping the relevant object in the Hierarchy.


  • Thanks @ChrisIceBox. That modification helped pin the error down to coming off my player prefab.

    This raises some further questions however.

    My game is 3D first person. The player prefab however has a 'first person camera' child object.

    Should this be needed if the scene has a local MainCamera? If I turn it off the game won't run and the console will produce the following error:

  • The FirstPersonCamera is treated like any other GameCamera - it's merely a reference for the MainCamera to use.

    The GameObject must be enabled, and the Camera component will be automatically disabled - the MainCamera will copy it's values every frame.

    Tin Pot has a similar setup - try running the 3D Demo with the Movement method set to First Person.

  • Got it. Thanks, that helps explain a lot.

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.