The fact is that the presence of this structure inside your (say) Mesh
object, in principle, will not do you any good. The reason at the time of the request to it, the value of the structure will be copied . Consider an example:
public class Mesh { public Vector3 MeshCogVector {get;set}; }
and somewhere in the code you have
public void CollisionDetection { for(int i=0;....) { Mesh curmesh = listofmashes[i]; Vector3 vec3 = curmesh.MeshCogVector;
Therefore, using this way in your conditions, in principle, you do not get any benefit + you increase the size of the Mesh
instance.
Instead of using / building this Vector3
instance inside the actual method, the moment you really need it, you quickly get stack allocation and quick garbage collection.
If you are not satisfied with performance in structures, you might consider using arrays of non safe
data. But this is what you need to measure to see if this scenario is right for you.
source share