AddReferenceObject vs. AddReferencedObjects

Some things such as TSets and TMaps aren’t supported by UPROPERTY. I’ve read that I had to implement static void AddReferencedObjects(UObject *InThis, FReferenceCollector &Collector);, which I did, but looking at some uses of it in UE4’s github, as well as documentation, I’m not real clear on the difference of FReferenceCollector::AddReferencedObject and FReferenceCollector::AddReferencedObjects.

Additionally, I was wondering if I have to call the reimplemented function at some point in my code or if the UObject ancestor class handles it automatically? I also have an enum with bitfields beyond value 255 and since I can’t use it as a UPROPERTY either, do I need to have that ref collected as well, or are value types not collected?

Nevermind, I brainfarted. Still, the second part of my post I am unclear about

TMap and TSet are now, for the most part, supported as properties.

When you do override UObject::AddReferencedObjects, you don’t need to call it. It’s called by the garbage collection framework as needed.

As for the enum, no, referencing is only for UObjects.

Alright. I tried TMap/TSet as properties but UBT gave me a slap on the wrist and told me “no”. This was with 4.9.1

It won’t work if you try to expose them to blueprints :slight_smile:

I know that much, but even then, it said no