2d-extras
2d-extras copied to clipboard
Allow extending the TileData struct
Being able to extend the TileData struct would be helpful when you want to add custom data to each tile. I can see that being a sealed class, so if extending is not an option, having something like a Dictionary or something similar inside the TileData struct would also work.
If im completely mistaken and there is another way to have each tile contain their own set of data, please let me know.
I haven't used it, but there's GridInformation which I think is what you want. Allows you to add data to tile positions using a String key + Value.
https://github.com/Unity-Technologies/2d-extras/blob/master/Assets/Tilemap/GridInformation/Scripts/GridInformation.cs
On Tue, Feb 12, 2019 at 2:36 PM duronrulez [email protected] wrote:
Being able to extend the TileData struct would be helpful when you want to add custom data to each tile. I can see that being a sealed class, so if extending is not an option, having something like a Dictionary or something similar inside the TileData struct would also work.
If im completely mistaken and there is another way to have each tile contain their own set of data, please let me know.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Unity-Technologies/2d-extras/issues/75, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYUKcZPjPKEUk1mqcSQFAyS65juwD91ks5vMxfDgaJpZM4a35zg .
Yes i've seen that script, it kind of does what i needed. But it seems fiddlier than needed, considering you have the tiledata readily available in the tile itself as well.
Right now if you want to lets say display different sprite based on some value, you have to instantiate that component somewhere, get the gameobject for it and then place and read your values to / from it.
Seems a bit too convoluted, but yes it does work :)
While if you have access to add data to tile tiledata instance, you have to create a custom tile and in the tile set/get those values and be done with it :)