Hi, I wanted to know if it was possible to remove all items from a certain category from the inventory?
I also needed help getting the whole 'removing everything from inventory' thing to work anyway,
I don't understand this part "Then attach it to a new GameObject, and use the Object: Call event Action to reference it. "
Does the game object need to be in the scene all the time? Does the gameobject need an action list on it or do you call it from a different action list altogether? Sorry I'm pretty dumb when it comes to instructions
Thanks

Comments
public int categoryToRemoveID;
public void ClearItemsInCategory ()
{
foreach (AC.InvItem item in AC.KickStarter.runtimeInventory.localItems)
{
if (item.binID == categoryToRemoveID)
{
AC.KickStarter.runtimeInventory.Remove (item);
}
}
}
Both the Object: Call event and Object: Send message Actions can be used. If you place the above code inside a new C# MonoBehaviour script, you should be able to make it a prefab by attaching it to a new empty GameObject and moving it into the Assets folder somewhere. IIRC you can still send events / messages to prefabs in that way, so you can do without having a local scene object.
Thanks
But in game it doesn't do anything, in fact it adds extra ones instead.
Debug.Log ("It's running!");
However, the latest v1.60.2 update now includes a function to clear the items in a given category - so it's better to just use that instead:
AC.KickStarter.runtimeInventory.RemoveAllInCategory (2); // where "2" is the category's ID
I'll fix it officially in the next release, but in the meantime you can open RuntimeInventory.cs, and replace the RemoveAllInCategory function (from line 633) to:
public void RemoveAllInCategory (int categoryID)
{
for (int i=0; i<localItems.Count; i++)
{
if (localItems[i].binID == categoryID)
{
Remove (localItems[i]);
i = -1;
}
}
}
The script to call it should then simply be:
using UnityEngine;
using System.Collections;
using AC;
public class ClearCategoryTest : MonoBehaviour
{
public int categoryID;
public void DoClear ()
{
KickStarter.runtimeInventory.RemoveAllInCategory (categoryID);
}
}
Thanks for that. All the items now get removed.