#Looking for item system advice

1 messages · Page 1 of 1 (latest)

nimble hill
#

Hey there,
I have a feature I want to build, but I can't quite figure out a good way to go about it in Unity ECS. I'm hoping some of you more experienced folks might be able to give me some advice.

I'm making a multiplayer game where players can have a variety of items they can use that they get to choose. I'm currently storing which items a player has in a synchronized dynamic buffer on the player entity, and an item type ID (currently an asset guid) is stored on each item in the buffer. Whenever the player uses the item, I need to look up info about that item on both the client and server (eg. what kind of projectile prefab that item can spawn). I was thinking about storing item type info in scriptable objects, but I'm not sure how to properly load them at runtime. Do I need to load them via AssetDatabase and convert them to a Blob? But then how do I convert a projectile prefab to an Entity like you can in a baker? Should I convert them at baking time somehow? Should I use a different approach altogether?

Another way I can think of to do this is to create the items as ghost prefabs, spawn them, and associate them with the player somehow.

I feel like there has to be a simpler solution though... any ideas?

graceful gust
#

id suggest to convert your item types into prefabs. Ingame just instantiate them and store on dynamic buffer of player

nimble hill
#

Hi Issue, thanks for the reply. Would you mind explaining why you think this is a better solution?

graceful gust
#

I don't think it's better. It's just simple and straightforward

#

Better is subjective to needs