Variable updating itself or not (ex: Transform vs Vector3)

When I do something like:

var object:Transform;

and assign it to some transform in my scene, it updates itself. If I call object.position, it gives me the current position of the transform.

however, if I do something like:

var someVector:Vector3=someOtherVector;

someVector won’t change if I change someOtherVector, unlike what happens to transforms, cameras, rigidbodies, etc.

What is causing that difference in behaviour? Is it a difference between structs and classes? Am I missing something?

If your someVector = someOtherVector code was inside an Update function, it would update. However, in your code, you’re just assigning it a value once.

Transforms, cameras, rigidbodies, etc. are objects. Vector3s, ints, Strings, etc. are not. That’s the difference. If you assign a variable to be some object’s Vector3 information, it will pay attention to that object.

Is it a difference between structs and classes?

Yes, structs (and primitive types) are by value, whereas classes are by reference.