Inventory.AddItem
Declaration#
public virtual void AddItem(string itemId, Int32 count, Action<AddItemResult> callback)Parameters#
| Name | Description |
|---|---|
| itemId | Id of the item to add |
| count | Number of the item to add |
| callback | Callback to invoke after action is completed with results |
Description#
Add an item to the container
Usage#
using NullSave.GDTK.Inventory;using UnityEngine;
public class Example : MonoBehaviour{
public void ExampleMethod(Inventory target) { target.AddItem(InventoryDatabase.instance.items[0].info.id, 1, AddItemResultCallback); }
private void AddItemResultCallback(AddItemResult result) { Debug.Log(result); }}Declaration#
public virtual void AddItem(GDTKItem item, Int32 count, Action<AddItemResult> callback)Parameters#
| Name | Description |
|---|---|
| item | Reference of the item to add |
| count | Number of the item to add |
| callback | Callback to invoke after action is completed with results |
Description#
Add an item to the container
Usage#
using NullSave.GDTK.Inventory;using UnityEngine;
public class Example : MonoBehaviour{
public void ExampleMethod(Inventory target) { target.AddItem(InventoryDatabase.instance.items[0], 1, AddItemResultCallback); }
private void AddItemResultCallback(AddItemResult result) { Debug.Log(result); }}