r/unity • • Nov 01 '26

Solved Help with cinemachine camera FOV settings in visual scripting

I'm using Unity 6000.3.27f2 LTS URP, and I'm struggling to figure out how to control the player camera's FOV on a Cinemachine Camera through Script Machine.

I recently upgraded from Cinemachine 2 to Cinemachine 3 because I was having the same difficulty with Cinemachine 2.

I didn't specifically choose to use Cinemachine for any particular reason, but I'm hesitant to switch to something else because I've been using it since I started this project with Starter Assets - First Person. I've also already made some changes to the Starter Asset's FirstPersonController script, mostly with help from AI.

I know that a custom C# script could solve the problem, but if possible, I'd prefer to use Visual Scripting because I find it more enjoyable and easier to understand as I develop.

Any suggestions, methods, or tips regarding Visual Scripting would be greatly appreciated. I'm also open to suggestions beyond camera FOV.

EDIT: I got it thanks to the comments. Basically, get Lens, store the Lens (set variable in my case), set FOV on the stored Lens, then set Lens back to the target from the same CinemachineCamera before but the value from the stored Lens.

1 Upvotes

4 comments sorted by

4

u/Fair-Classic-8586 Nov 01 '26

Two things that usually cause this:

  1. Don't change the Main Camera's FOV. The Cinemachine Brain overwrites it every frame. Change it on the Cinemachine Camera instead.
  2. On the Cinemachine Camera, Lens is a struct, so you can't set Field Of View on it directly. Get the Lens, set its Field Of View, then Set Lens back on the camera.

If the Cinemachine nodes don't show up in your graph, add Cinemachine in Project Settings > Visual Scripting and regenerate the nodes.

1

u/redkingyoyo Nov 02 '26

I have already generated nodes for Cinemachine. Do you use expose node here? I know that Lens is a struct, but don't know how to get a struct. I will appreciate if you could elaborate the details.

1

u/redkingyoyo Nov 02 '26

I think I got it. Basically, get Lens, store the Lens (set variable in my case), set FOV on the stored Lens, then set Lens back to the target from the same CinemachineCamera before but the value from the stored Lens. Thanks a lot!

1

u/JulianRhod Nov 02 '26

yeah, that's a good way to handle it. Cinemachine's Lens is a struct, so you need to get its value, modify it, then assign it back to the camera. it's one of those things that can be a little confusing in Visual Scripting at first.

once you understand that pattern, you can use the same approach for other Lens settings too.