How do you change RotationDegrees.y in c#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bypell

tried this line:

scopepiv.RotationDegrees.y = Mathf.Clamp(scopepiv.RotationDegrees.y, -100.0f, 100.0f);

but it says that I can’t modify the return value of Spatial.RotationDegrees.y because it is not a variable.

how are you supposed to modify the x/y value of a vector3 property in c#???

:bust_in_silhouette: Reply From: Magso

It’s one of the main drawbacks of C#, the structs (x, y, z) have to be set to a Vector3 variable instead of being changed directly.

Vector3 rotation;

void YourFunction()
    rotation.x = //value;
    rotation.y = //value;