According to the docs, unities Vector3
are value types.
Also according to the docs "By default, on assignment, passing an argument to a method, and returning a method result, variable values are copied. In the case of value-type variables, the corresponding type instances are copied".
Not an expert in performance, pointers and so on, but I think its fact that passing arguments by reference instead by value to avoid making copies of instances is a good practice regarding performance. Indeed that's why most of the types in c# are reference types.
Same for the RaycastHit struct.
From as far as I researched classes and structures have the following basic differences
- classes are reference types and structs are value types
- structures do not support inheritance
- structures cannot have default constructor
For my none of this would justify giving up the performance of ref types benefit,so, mainly Vector3
where in any game there are going to be vectors passed around as arguments so copied all over the app,what is the reason of it being struct type?