I have tried lots of different thing, Im just shooting in the dark atm because I just dont know how this works.
Am I maybe adding the code in the incorrect place?
Do I have to set something up on the character?
I have onimpact listner working but this seems to work differently.
I have added it to the character, and am also using UIS.
C#:
using System.Collections;
using System.Collections.Generic;
using Opsive.Shared.Events;
using Opsive.UltimateCharacterController.Inventory;
using Opsive.UltimateInventorySystem.Core;
using Opsive.UltimateInventorySystem.Core.DataStructures;
using UnityEngine;
public class InventoryListners : MonoBehaviour
{
public GameObject m_Character;
private void Start()
{
var inventory = m_Character.GetComponent<InventoryBase>();
if (inventory == null) {
return;
}
EventHandler.RegisterEvent<Item , int>(gameObject, "OnInventoryEquipItem", OnInventoryEquipItem);
// EventHandler.RegisterEvent<ItemInfo, ItemStack>(gameObject, EventNames.c_Equipper_OnChange, Equipper_OnChange);
}
private void Equipper_OnChange(ItemInfo itemIdentifier, ItemStack slotID)
{
Debug.Log("The inventory used " + itemIdentifier + ", " + slotID + " slot#.");
}
private void OnInventoryEquipItem(Item itemIdentifier, int slotID)
{
Debug.Log("The inventory used test " + itemIdentifier + ", " + slotID + " slot#.");
}
public void OnDestroy()
{
//EventHandler.UnregisterEvent<ItemInfo, ItemStack>(gameObject, EventNames.c_Equipper_OnChange, Equipper_OnChange);
EventHandler.UnregisterEvent<Item , int>(gameObject, "OnInventoryEquipItem", OnInventoryEquipItem);
}
}
Am I maybe adding the code in the incorrect place?
Do I have to set something up on the character?
I have onimpact listner working but this seems to work differently.
I have added it to the character, and am also using UIS.