Search Unity

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

    bjarkeck

    Joined:
    Oct 26, 2014
    Posts:
    301
    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.

    upload_2020-2-25_12-4-36.png
     
    Last edited: Feb 25, 2020
    Peter77 likes this.
  2. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    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.