T
T
Take_it_and_do2022-01-22 01:14:58
Unity
Take_it_and_do, 2022-01-22 01:14:58

How to use ScriptableObject to store the state of an item in the inventory in Unity 2d?

I need to use having one object and several of its states using ScriptableObject for inventory as an item. For example, I need to create a bucket. It can be in different states (empty, with water, etc.). That is, I take a bucket, pour water, and it changes its sprite to full (That is, this bucket prefab must change its sprite data, save it, and the next time the bucket is thrown out of inventory, it should be in state 1 (was 0)). How can I do this with a ScriptableObject?

How to create such items that have different states like a bucket, being the same object?
For example, the same bucket from minecraft, which, without leaving the inventory, can change its state.

I have included two screenshots below. In the first, everything is fine (because an apple can only be in one state), but with the second (I don’t know a bucket). There were thoughts only to create a separate SO for each state of the bucket and change them in the inventory and the game
61eb2d6c5aa46159054415.png61eb2d79e4146354682746.png

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question