OnEquipItem Event problem with signature

Szymon Z.

Member
Hello !


I want to use one of the implemented events in Character Inventory Bridge (i want to use event On Equip Item Event). I see that parameters are <Item, int32>. But for me it's not possible to assign any function with parameter to this event...

Currently my method signature seems like that one on the screen. I also tried to use different signatures like:

UltimateInventory.Core.Item, int ;
UltimateInventory.Core.Item, int32;
UltimateCharacterController.Item, int;
UltimateCharacterController.Item, int32;

No success at all. I can bind only empty function (without any parameters) to this event, but i want to receive what item has beed equipped. Is that event just not working ?
 

Attachments

  • obraz_2021-06-21_103901.png
    obraz_2021-06-21_103901.png
    15.5 KB · Views: 7
Are you Johnny__ from the Discord channel? He had the exact same issue.

The event takes in a Character Item and an int.

Here is an example script, I added this to a gameobject called TestComponent:
Code:
using UnityEngine;
using Item = Opsive.UltimateCharacterController.Items.Item;

public class TestComponent : MonoBehaviour
{
    public void Test(Item item, int amount)
    {
        Debug.Log("Test");
    }
}

Here is how I hooked it up in the inspector.

1624272719662.png

Everything works as expected.

Make sure you do not have any errors in your project and that your code compiled.
What is your Unity version? The event in the inspector is a UnityEvent, Perhaps this is a Unity bug, search online to see if other people experienced the same issue on your Unity version.
 
Top