Hello, I am having an issue with my code where I am trying to set the 3D Cameras Fov in the player script. I was able to get the Fov change to work when writing the script like an expression:
the behavior you are describing is to be expected. Your first code snippets adds and subtracts repeatedly. Your second code snippet updates to the same value every time – and therefore there is change once and never again.
Note that the expression _camera.fov -= 30 means the same as _camera.fov = _camera.fov - 30 (it is a short form for exactly this!), which means the current field-of-view (Fov) value is read, then modified (-30) and finally written back into the Fov property (Unlike in Math in programming the expression a = b is not symmetrically but assigns b into a, which means it moves what is on the right of the equation into what is on the left – that is also why there can only be variable names on the left side).
Kind regards
P.S.: I am now going through the documentation for the Fov of a Camera3D. It says there the Fov property represents the angle in degrees. So this field is not just a regular float. That is something to keep in mind.