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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Feedback Possible to get a tilemap changed event?

Discussion in '2D' started by CDF, Oct 10, 2019.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,283
    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:
    1,068
    Yes, that is a fair request and will be added to our backlog for consideration.
     
    theforgot3n1, palex-nx and CDF like this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,283
    That would be awesome, thanks
     
  4. BirdiePeep

    BirdiePeep

    Joined:
    May 12, 2015
    Posts:
    10
    I'd also like to request this is added. Being unable to receive update events about the tilemap feels a little ridiculous. I'm not entirely sure what Unity is attempting to protect us from by hiding so much behind the curtains.
     
  5. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,283
    theforgot3n1 likes this.
  6. bigcheese_

    bigcheese_

    Joined:
    Sep 6, 2011
    Posts:
    31
    Is it a bug that the tilemapTileChanged doesn't get triggered when we undo?
     
  7. ChuanXin

    ChuanXin

    Unity Technologies

    Joined:
    Apr 7, 2015
    Posts:
    1,068
    I guess this is an annoying issue. The Undo system works differently from the tilemapTileChanged callback system. We will see how we can do this better by seeing if we can work in the Undos into this!
     
    theforgot3n1 likes this.
  8. lennardbeers

    lennardbeers

    Joined:
    Apr 28, 2017
    Posts:
    10
    Was this feature removed in later versions? I can't find the event in the Tilemap class.

    EDIT: Ohhh, it's a static event, nvm.
     
    Last edited: Nov 15, 2020
  9. pedro_unity228

    pedro_unity228

    Joined:
    Jul 3, 2018
    Posts:
    4
    Came here to say THANK YOU for requesting and for implementing this (to the appropriate parties). It's very useful. Too bad it doesn't work with undo, maybe there's a different event I can listen to.
     
    theforgot3n1 likes this.