Resource Handlers
Resource handlers provide a way to customize the adding or removal of resources from a resource container in the inspector.
To create it in your own script, simply add a Resource Handler variable and it will appear in the inspector with all the settings you can change.
Checking Resource Handlers
You may want to check if a resource is available before running some code, for example to check if ammo is available before firing. You can do this by calling the Ready function on the resource handler, which returns True if the specified resources are available, and False if not.
Implementing Resource Changes
Once you've checked if a resource is available, you can implement the resource change by simply calling the Implement function on the resource handler, which will carry out the transaction with the resource container.
So if you want to draw ammo after firing, for example, run the firing code and then call Implement on the ammo resource handler, or vice versa.
Last updated