Huge blocking by equal operator error

I have a problem that doesn’t even make any sense.
Basically, I created two new custom classes, one being a register for the game’s items, the other one being a data holder for items, both inherited from UObject.
I keeps saying operator= isn’t accessible.

Two days in already and I still can’t find a fix.

Thanks.

Can you provide the line of code that triggers the error?

What is the return type of GetData()?

itemList.GetData()[sizeof(itemList) - 1] = *item;

have you overloaded operator= for your item class?

Yes, and i’ve made it public also

can you try just

itemList.GetData() = *item;

What type is itemList what type is item?

GetData returns primitive C++ array from TArray, which is actually just pointer (of type same as array) to array data

itemList is a TArray of UItem. I created UItem and it’s derived from UObject. It’s supposed to be a data holder for various items to have easier references for both c++ & blueprints.

Found a work-around. I’m not gonna store references in TArrays since assignment operator overloading doesn’t seem to work. I created different registers inherited from UBlueprintFunctionLibrary, each ones for specific object types.

Where, for example, with my UItem class:

  • I will create an instance of UItem for each items in the game as static members of the register class (needs operator new overload, which works)
  • make a get() function for each

Then I can call my get functions in c++ and blueprints and boom, done.
This method also assures that whenever I want to change an item property (ie. name), this updates for all get calls, since it is static.

Thank you all for your help, I really appreciate it.