Today, I will write a little post about chests that you can find around in the maps and in the caves. When you open the chest, you will find a health potion that you can take with you and use whenever you want.
First, we need to create the health potion prefab which is a Gameobject with a Sprite Renderer, a Box collider and a script which gives the player an health potion.
Next, we need to create the Chest prefab. To create the Chest, we start with an empty GameObject, and add Sprite Renderer, Box collider and one script. The script takes two sprites, one for un-open and one for open chest which changes after you have opened the chest. The script also takes the health potion prefab which it spawns upon the chest when opened.
P219 Development Team