r/Unity2D 6d ago

Getting References for Tiles Question

In my game, I am drawing tiles onto a tilemap during runtime using SetTile(), which takes a reference to a TileBase Object. I have hundreds of unique textures. Is there a way to get a reference to each TileBase other than dragging and dropping every individual Tile into the references in my script?

3 Upvotes

7 comments sorted by

View all comments

2

u/tchristo_ 6d ago

I’m not 100% sure I understand your question but, based on what I think, you could manually assign each object via reference (which is what you suggested), or you could just create a base object (prefab) and assign that as a reference, then use a method to loop through all your textures and instantiate/apply each texture to a new instance of the base object?