Download

Getters not getting anything in blueprint

Hello folks !
Today I am having a weird bug which could really use your help. I am coding an inventory system which is inside a component. At first I made it inside the character controller, and it worked all fine but decided to do some refactorisation.

Here is the problem, I have 3 TArray inside my component which get update trough member functions (like, additem, removeitem etc). This is all good, I get log message telling me what the inventory contains etc, no problem.
The thing is, for display reason, I want one of my umg to access these TArray. But I get absolutly nothing. Anybody can tell me what am doing wrong please ?

The c++ code in public :



public:
    /** Return the tapes by reference*/
    UFUNCTION(BlueprintCallable, Category = "Inventory")
        void GetInventory(TArray<int32>& inIDs, TArray<int32>& inCounts,TArray<FName>& inTapes) const
    {
        inTapes = TapeIDs;
        inIDs = IDs;
        inCounts = Counts;
    }

    // Called every frame
    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
        TArray<int32> IDs;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
        TArray<int32> Counts;

    UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
        TArray<FName> TapeIDs;


So this gives us this once in blueprint :

But I don’t get any value out of this.
Does anyone have an idea why ?
Thanks a bunch !!!

Gotta add that trying to direct access the variables (that’s why I tested to put these in public) isn’t doing much more to me. I am probably not accessing the thing that I modify with member functions. But it makes no sense as this is the same member variable…
Could it be that TArray that are modified using “.add” or “.remove” are not correctly assigned to the member variable ? I don’t think it’s possible considering if I try to add more items, it correctly add these to the already existing items.Meaning I can access the right member variable from within the class. The problem is getting the values out of the class for some reason.