Cinemachine camera not transitioning?

Hey,

im trying to transition between cameras using cinemachine by manipulating priority values on given cameras. tho the priority values are changing as expected, the cameras themselves arent transitioning so im not really sure whats going on.

here is the logic for my priority stuff

any help is appreciated :))

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;

public class PlayerCamera : MonoBehaviour
{
	public CinemachineVirtualCamera[] cams;

	public CinemachineVirtualCamera movementCam;
	public CinemachineVirtualCamera diceCam;

	public CinemachineVirtualCamera startCam;
	private CinemachineVirtualCamera currentCam;



	// Start is called before the first frame update
	void Start()
    {
		currentCam = startCam;

		for(int i = 0; i < cams.Length; i++)
		{
			if(cams[i] == currentCam)
			{
				cams[i].Priority = 1;
			}
			else
			{
				cams[i].Priority = 0;
			}
		}
    }

	public void switchCam(CinemachineVirtualCamera newCam)
	{
		currentCam = newCam;

		currentCam.Priority = 1;

		for(int i = 0;i < cams.Length; i++)
		{
			if (cams[i] != currentCam)
			{
				cams[i].Priority = 0;
			}
		}

	}

}

Whenever you think that thought then it is… time to start debugging!

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

1 Like