I am trying to put a Header before a field which utilizes getter + setter shorthand syntax but I am getting a compile time error saying "Attribute 'Header' is not valid on this declaration type. It is only valid on 'field' declarations."
Apparently it is no longer considered a field after putting the {get;set;}
If I remove the shorthand syntax it works but ideally I want it to stay there. Is there a way to make this work?
The line involved is line 4 with the moveSpeed
field.
public class PlayerController : MonoBehaviour
{
[Header("Movement")]
[SerializeField] private float moveSpeed { get; set; } = 2.0f;
[SerializeField] private float jumpForce = 250f;
}
I am using Visual Studio 2019