> For the complete documentation index, see [llms.txt](https://earnest-robot.gitbook.io/auto-hand-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://earnest-robot.gitbook.io/auto-hand-docs/auto-hand/dispenser-point.md).

# Dispenser Point

Dispenser points allow grabbables to be dispensed in predetermined points or areas. A dispenser point will take an object in the scene or a prefab and will allow the player to take copies of that item from the point

Dispenser will hide the given source object and dispense copies. If `destroy on reset` is disabled the dispenser will automatically pool the dispensed objects, this is more optimized but will not always give the desired results, for example: when dispensing ammo for a gun turning `destroy on reset` off will cause the already used ammo to be dispensed once the `max copies` are reached instead of a brand new fully copy

![](https://2959669391-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F5zKO0EvOjzUDeT2aiFk3%2Fuploads%2FotmL6Jnoo6Aof8CwdRJo%2Fimage.png?alt=media\&token=c96697c8-3036-4615-b1a7-6941802ac96b)

### Dispenser Settings

* `Dispense Object` The object to be copied and dispensed
* `Max Copies` The maximum copies allowed to exist from this dispenser before they are destroyed or pooled
* `Reset Delay` Time in seconds before the next dispense appears
* `Disable Body` Whether or not objects placed in the dispense point should be set to kinematic on placed or not
* `Is Kinematic` Whether or not objects placed in the dispense point should be set to kinematic on placed or not
* `Destroy On Reset` If true the object will **not** be pooled and reset its position on reset it will be destroyed and a new copy will be placed. Less performant but important for things like ammo that should always respawn as new clips full
* `Max Distance` The maximum distance a dispensed object can move from the point before the next object is dispensed

`On Grab Dispense` called when the dispensed object is grabbed

`On Dispense` called when a new dispensed item is spawned

## **Programming Info**

Connect Dispenser Point events through a custom script

```csharp
using UnityEngine;
using Autohand;

public class DispenserEventTemplate : MonoBehaviour {
    public DispenserPoint dispenserPoint;

    void OnEnable() {
        dispenserPoint.OnGrabDispenseEvent+= OnGrabDispense;
        dispenserPoint.OnDispenseEvent+= OnDispenseEvent;
    }

    private void OnDisable() {
        dispenserPoint.OnGrabDispenseEvent -= OnGrabDispense;
        dispenserPoint.OnDispenseEvent -= OnDispenseEvent;

    }

    public void OnGrabDispense(DispenserPoint point, Grabbable grab) {
        //Stuff happens when the dispensed grabbbale is grabbed
    }

    public void OnDispenseEvent(DispenserPoint point, Grabbable grab) {
        //Stuff happens when a new object is dispensed, references the new grabbable that appears in a dispenser

    }
}
```
