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.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

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

Discussion in 'DOTS Physics' 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.