- Home /
Design approach opinion needed on tilemap vs gameobject
Hello
I am building a game for mobile which has a basebuilding element. It is a 2d game, and I started out by using the new tilemap feature added in the new version of unity.
All was going well until I discovered that individual tiles cannot store their own variables, they are all clones. eg, I made a scriptable tile which had an int Hitpoints on it. When hitpoints <= 0, the tile is destroyed. Pretty straight forward, except when you kill one, you kill every tile of that type :P
I have counteracted this by having a scene object which contains an array, tracking the hitpoints of each destructable tile, and disposing of it when it is dead, but now I hit another problem, doors. I can make an animated tile which represents a door, but using tilemap, I cannot control individual doors.
So now I am at a bit of an impass, do I just use the tilemap for static landscape, and represent everything that is destructable with a gameobject? Or do a hybrid where my non animated tiles live on the tilemap, and animated ones exist as individual gameobjects?
As this is a mobile app I am concerned about performance so set out with the intent of using the smallest number of GO possible.
Would be appreciative of any input, not looking for a definitive answer, but would be keen to hear how other people might tackle this :)
Your answer
![](https://koobas.hobune.stream/wayback/20220612145407im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Texture/Object not visible 0 Answers
Game freezes everything when calling WaitForSeconds 1 Answer
Very weird dark level loading? 4 Answers