✅ confused by this error
Cannot modify the return value of 'Player.Velocity' because it is not a variable in the Input methodall i am doing is modifying the field of the struct, why is that a problem?
Cannot modify the return value of 'Player.Velocity' because it is not a variableInputclass Player(Vector2 position, Vector2 size) {
public Vector2 Position { get; } = position;
public Vector2 Velocity { get; private set; } = Vector2.Zero;
public Vector2 Size { get; } = size;
public Rectangle GetRect() {
return new(Position, Size);
}
public void Input() {
float dt = GetFrameTime();
Velocity.X = 0.0f;
}
}