Why there is need to create transform each time in c# when modifying its basis

Godot Version

4.2

Why cant i set transform directly ? only create new one each time when i like to change the basis ?

Only this works:

private void CameraLook(Vector2 Movment)
	{
		CameraRotation += Movment;
		CameraRotation.Y = Mathf.Clamp(CameraRotation.Y, -1.5f, 1.2f);

		Transform3D transform = Transform;
		Transform3D cameraTransform = MainCamera.Transform;

        transform.Basis = new Basis();
		Transform = transform;

		cameraTransform.Basis = new Basis();

        MainCamera.Transform = cameraTransform;

	}

why can’t i just do

MainCamera.Transform.Basis = new Basis()

or
Transform.Basis = new Basis()

Thanks

It’s explained here C# basics — Godot Engine (stable) documentation in English

5 Likes