Forum rules - please read before posting.

Changing the camera with transition in script

Hi,

I'm trying to use the SetGameCamera() method in a script. It's working, however, when I try to make a transition over time, it has no effect.
The method needs to be called in a script that's attached to a game object in the scene. It is no custom interaction script. SetGameCamera doesn't return anything (void), so I was not under the impression that it needs to go into a coroutine. Any ideas what I might be doing wrong here?

The code looks like this:

public void OnConversationStart(Transform actor)
{
    if (ConversationCam != null)
    {
        KickStarter.mainCamera.SetGameCamera(ConversationCam);
    }
}

changing it to KickStarter.mainCamera.SetGameCamera(ConversationCam, 2, MoveMethod.Linear); or sth similar has no effect, the game still hard cuts to the new cam.

Comments

  • Looks fine.  No, a coroutine is not necesserry - the MainCamera takes care of camera change "over time".

    AC and Unity version numbers, please.  Also, what is your Movement method set to?

    As I can't picture why this would occur, some simple Debug statements might help shine a light.  In MainCamera.cs, look for the "SetGameCamera" function (around line 914).  At the very end, place in the following:

    Debug.Log ("Transition to: " + attachedCamera + ", Transition time: "+ transitionTime);

    What's the Console's output when the code runs?
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.