Here's my code:
public void PlayCardChest()
{
Debug.Log("Open Chest");
GameObject itemGO = new GameObject();
ItemCollector newItemCollector = itemGO.AddComponent<ItemCollector>();
newItemCollector.settings.collectionType = ItemCollectorType.Box;
newItemCollector.settings.useLoot = true;
newItemCollector.settings.loot.SetAsset(ORK.Combatants.loot.loot[1]);
newItemCollector.StartInteraction(itemGO);

}
This generates a gameobject with a configured ItemCollector component, but StartInteraction() does nothing. No information in the debug console as to why nothing is happening. If I copy the generated gameobject into the scene and change the start setting to Auto->Start, and then press Play, the component will correctly display the item box for collection.

Thanks,
-Mike
  • The item collector you created most likely isn't set up to start on interaction.
    Instead of using StartInteraction function, set it up to auto start and it should start on it's own:
    newItemCollector.startSettings.autoStartSetting.isStart = true;
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • This works for my purpose thanks!

    Please note I tried this before asking for help and it did not work:
            newItemCollector.startSettings.interactStartSetting.isInteract = true;
    newItemCollector.StartInteraction(itemGO);

Sign In or Register to comment.