I'm new to Unity Cinemachine and I'm trying to change the y value of the Tracked Object Offset in the Body of CinemachineVirtualCamera using code.
I read some articles for changing the value and what I currently have on my code is
private CinemachineCameraOffset cinemachineOffset;
Void Start() {
cinemachineOffset.m_Offset = this.transform.localToWorldMatrix * new Vector3(0, 20, 0);
}
Then I get the error message saying NullReferenceException: Object reference not set to an instance of an object
, and when I print out the value of cinemachineOffset
, I get null, so I think I'm not doing right. So I was wondering how I can access the Y value of the CinemachineVirtualCamera of the Body...