Search Unity

Feedback `ITilemap` is not an interface, why the `I` prefix?

Discussion in '2D' started by Elringus, Aug 26, 2020.

  1. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    483
    Continuing the other topic (locked now), I'd like to ask why `ITilemap`, being a class, has the `I` prefix, which conventionally used for interfaces in C#? It's really confusing when working with the API for the first time. I suppose there was a good reason for naming it like this; if so, please let us know and mention that in the docs. Otherwise, please consider renaming the class or making it an actual interface.
     
    kukurenaiz and spryx like this.
  2. spryx

    spryx

    Joined:
    Jul 23, 2013
    Posts:
    557
    Agree...that is super confusing. TilemapData maybe?
     
    kukurenaiz likes this.
  3. Deleted User

    Deleted User

    Guest

    I guess @ChuanXin can answer that.

    What about asking nicely?
     
  4. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    483
    Uhm, was "please" not enough to sound polite? Sorry, I'm not a native speaker; didn't mean to be rude in any way.
     
    kukurenaiz and JoNax97 like this.
  5. Vryken

    Vryken

    Joined:
    Jan 23, 2018
    Posts:
    2,106
    They didn't come off as rude to me.
     
    kukurenaiz and JoNax97 like this.
  6. Deleted User

    Deleted User

    Guest

    Here is a possible answer to your question: https://alexfranchuk.com/blog/internal-interface-classes-in-csharp/ and I bet this is it.
     
  7. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    483
    kukurenaiz likes this.
  8. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    ITilemap was an interface when it was first created with the Tilemap component implementing this interface. However, this was brought up as a potential issue for future API changes in our code review, hence the change to its current state.

    Unfortunately, renaming the class or turning it back into an interface at that point of time (and now) brings the possibility of causing issues when users upgrade to a Unity version with that change, which may not be mitigated by the Unity Script Upgrader. We will keep this in mind for a future iteration of the Tilemap feature (eg. Dots). If you have further questions about this or other APIs, do let us know!
     
    kukurenaiz and Deleted User like this.
  9. Elringus

    Elringus

    Joined:
    Oct 3, 2012
    Posts:
    483
    Thank you for the response! Can you please clarify why you named it `ITilemap` when decided to change the interface to a class after the code review. Why not `TilemapData` or something else, without the `I` prefix?
     
  10. Deleted User

    Deleted User

    Guest

    It was already named ITilemap since it was an interface, they just didn't change the name for the reasons explained when they changed it to a class
    .
     
  11. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    To further clarify this, the API had already been released to the public as a preview release. We did not want to cause issues as mentioned above, hence keeping it the same.
     
    Deleted User likes this.