Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Feedback Possible to get a tilemap changed event?

Discussion in '2D' started by CDF, Oct 10, 2019 at 2:43 AM.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    775
    Looking at the Tilemap class https://github.com/Unity-Technologi...lob/master/Modules/Tilemap/Managed/Tilemap.cs

    I see this perfect event:

    "internal static event Action<Tilemap, SyncTile[]> tilemapTileChanged;"

    But like everything good in Unity, it's internal and can't be referenced by us mere mortals.
    I've also failed at trying to use reflection here, as I'm unable to create a Delegate that accepts "Tilemap.SyncTile", as that class is also internal :( It's almost like Unity knew someone would want this functionality and put up the big internal wall of doom.

    If anyone knows how I can create a Delegate using Reflection to receive tilemapTileChanged event and handle it, I'd love to know. But I feel it's impossible.

    Anyway, wondering that maybe in the future Unity could spend some time changing 2 lines of code from "internal" to "public" so I can listen to tilemap changes and generate some data around that :)
     
  2. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    322
    Yes, that is a fair request and will be added to our backlog for consideration.
     
    CDF likes this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    775
    That would be awesome, thanks