Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feedback Please use public fields instead of properies in general purpose structs

Discussion in 'Physics for ECS' started by bjarkeck, Feb 25, 2020.

  1. bjarkeck


    Oct 26, 2014
    It is so frustrating when I can't modify the data directly and have to take copies, modify the copy, and then assign the data back.

    I think it would be a really bad idea if you started to introduce custom logic in the get & set accessors for simple general purpose structs like this so I don't see any good reason why they couldn't be public fields.

    Last edited: Feb 25, 2020
    Peter77 likes this.
  2. steveeHavok


    Mar 19, 2019
    In this case you make a fair point. In some places we do need to use properties over fields as there is versioning logic to ensure swappable simulation backends (e.g. at the Collider level rather then the Geometry level). We'll review the properties usage again where unnecessary.
    Nothke and cultureulterior like this.