Open SamJessop opened 3 years ago
Hi, could you share your use-case for this? Thanks! This would help in understanding what you require from this.
For doing so, you may need to created a new Brush inheriting the GameObjectBrush and overriding the Paint method to get the behaviour that you need.
Hello,
My use case is that I have a grid and on that grid I mark all tiles as walkable or unwalkable for pathfinding (for moving unit around RTS style) based on if a building or object is placed on that tile (using layers and different TileMaps) Just like an RTS the player can place buildings and when a building is placed I want to be able to recalculated any tiles that the sprite covers using the renderer.bounds from that game object that is painted.
My current work around is to get the object based on where the player has clicked (hense placed the gameobject) but it would be way nice if I could just go:
var newBuilding = GameObjectBrush.Paint(....);
Thanks for sharing that!
For your use-case, I would suggest creating a new Brush with an overriding Paint method with a callback when a GameObject is added. The Paint API is meant to be generic for interacting with the Tilemap Editor system, eg. instead of GameObjects, the Brush paints Tiles or changes colors and does not require the return of GameObjects.
Hope this helps!
Thank you, I'll give it a go.
GameObjectBrush.Paint() does not return the GameObject it has just painted. Is there a way to do this currently or something that will be implemented in the future?