Skip to main content

Inventory.ReplaceItem

Declaration#

public void ReplaceItem(string instanceId, string itemId)

Parameters#

NameDescription
instanceIdInstance Id of the item to replace
itemIdId of the item to replace with

Description#

Replace an existing item with a new one

Usage#

Example
using NullSave.GDTK.Inventory;using UnityEngine;
public class CodeSample : MonoBehaviour{
    public void ExampleMethod(Inventory target, GDTKItem oldItem, GDTKItem newItem)    {        // Removes an item from inventory and replaces it with a new one        // If item was equipped, the replacement will be as well        target.ReplaceItem(oldItem.instanceId, newItem.info.id);    }
}