- Home /
Programatically change CineMachine blend mode
One thing i\m definitely noticing is a lack of Programming API related documentation when it comes to this asset. Which I guess the GUI/Inspector documentation is pretty decent, we need API documentation with more examples than then one provided that does nothing beside switch an enable state on and off :p
Sorry, back to the question, im trying to update the blend mode of my virtual camera during play time programatically.
Its pretty simple, when engaging in a dialogue interaction with an NPC, the current EaseInOut blend mode beautifully zooms into the setup virtual camera im looking for. It looks aces.
But in my setup, the camera switches perspectives during dialogue bits. I want these to be Cut's instead of smooth transitions .
But have absolutely no idea how to set that value!
if(previousSecondaryCamera != null)
{
mainCamera.GetComponent<CinemachineVirtualCamera>(). // ?? I wish to set a cut blend mode here
previousSecondaryCamera.GetComponent<CinemachineVirtualCamera>().Priority = 1;
}
Answer by trockc · Aug 29, 2017 at 03:16 AM
I think you need to reference CinemachineBrain. Setting the blend time to 0 equals a cut.
private CinemachineBrain brain;
void someMethod () {
brain = FindObjectOfType<CinemachineBrain>();
brain.m_DefaultBlend.m_Time = 0; // 0 Time equals a cut
}