Table of Contents

Automatically pick up gold and health potions

class MyHero : AutomaticHero
{    
    
    void Update()
    {
        var item = FindClosestItem("Gold", "Vial of Health");
    
        if (item != null)
        {
            PickUp(item);
            return;
        }
    }
    
}

You can implement a shortcut for opening your inventory like this

class MyHero : AutomaticHero
{
    void Update() // all the time
    {
        if (Input.GetKeyDown(KeyCode.F2)) // check if use presses the F1 key
        {
            OpenInventory();
        }
    }
}

Beware that with multiple heroes, this would open all their inventories, checkout party tutorial for more information.