Bionic_Ape
(Bionic_Ape)
October 13, 2016, 8:35am
1
Hi,
I have some properties that are only accessible via C++. So they don’t need to be accessible by blueprints.
After reading what the documentation says about Properties , I used “Native” but I got “Unknown variable specifier Native”.
UPROPERTY(Native, Category = Achilipu)
UMaterial* MasterMaterial;
How can I properly define a property that is not going to be accessed by blueprints nor the editor but I still want it to be handled by the garbage collector?
Many thanks.
Jawdy
(Jawdy)
October 13, 2016, 8:59am
2
There’s a full page on the Wiki about UObjects, dynamic allocation and the UE4 Garbage Collector, you can find it here .
A snippet from the article (in case the link ever breaks or changes):
UE4 Garbage Collection only counts references to UObjects that are UPROPERTY()
Which you can delcare in your header:
UPROPERTY()
UMyObjectClass* MyGCProtectedObj;
And instantiate (in your CPP):
MyGCProtectedObj = NewObject<UMyObjectClass>(this);
Note the UPROPERTY() Macro declaration with no parameters.
Hope that helps