# How to draw grass sprites without using gameobjects?

I am making a rimworld-like procedurally generated 2D game using Unity's tilemap system.

Just like tiles, I also have to procedurally generate grass and trees. Each grass instance should have logic inside that keeps track of it's growth progress and update the grass size appropriately.

The downside is, I have to have maps as big as 400x400. That could be THOUSANDS of grass instances and each of them having their own GameObject seems ridiculous and like the game would lag.

How can instantiate those grass sprites without creating new gameobjects for each one while still being able to control the growth and similar things?

(Come to think of it, the DOTS / ECS system in Unity would be perfect for this, however it is nowhere near ready and many things I want to do are just not supported.)

Then create one gameObject. Let's call it GrassManager and put a script with the same name on it. That script internally has a tile[400][400] array and a reference to that TileMap. Those array entries contain structs with all the data related to the grass growth of each tile. Like whether or not it has grass at all, its current growth progress, any tile properties which influence grass growth (moisture? temperature? fertility?) and when it was last updated.
• @jolefull96 That depends. When trees and grass are mechanically identical, then you could use a general PlantGrowthManager. When they have notable mechanical differences, then it might make sense to separate them. How many tilemaps you would use depends on how many objects there can be on a tile. Can there be grass AND a tree on the same tile? Then you need two separate tilemaps for grass and trees. Can there be only a tree OR a rock on a tile? Then those can be on one "objects" tilemap. Are trees/rocks interactable objects with behavior? Then they might have to be full-fledged game objects. – Philipp Feb 14 at 10:49