In a game like Minecraft, the player could have any of several hundred types of items in their inventory. Players can drop those items into the world, but obviously how they're rendered in the world differs from how they're rendered in the inventory.
I'm trying to understand how to design for this scenario using Unity's GameObject concept.
Individually, it seems like the expectation is that:
- I would have one GameObject (with at least a
SpriteRenderer) for every unique item that can appear in-world.
- I would have one GameObject (with at least an
Imagecomponent) for every unique item that can appear in inventories.
With so many, I also need to come up with some sort of directory so that I can associate bulk prefab objects for use in-game.
Is this accurate? I feel like that's a lot of overhead.
Would I be able to create one GameObject with both a
SpriteRenderer and an
Image and maybe toggle between then based on whether its in world or an inventory?
I had also considered using one generic GameObject and replacing the sprite/image based on the item needed, but that feels like it's misusing what GameObjects are meant for. It also likely subverts the benefit of pooling them, etc.
Is there another approach I'm missing?