Keep structs at or below 16 bytes as a practical guideline: they are passed by value by default, so large structs can copy more data and be easier to misuse. This is not a hard limit; performance depends on the CPU, compiler, runtime, and calling convention. Larger structs can still work, especially when passed by ref. section 2.1
Small value data and EnemyData
Vector2 (8 bytes) and Vector4 (16 bytes) are examples of small structs. EnemyData is better represented as a class: it contains arrays, combines data not always used together, and exceeds 16 bytes. section 2.1
Listing 2.1 C# class holding all the data for all enemies
public class EnemyData
{
public Vector2[] Position;
public Vector2[] Direction;
public float[] Velocity;
}The EnemyData listing shows its position, direction, and velocity arrays. section 2.1
