GC & UPROPERTY, working with CreateDefaultSubobject / NewObject
I'm studying GC system of UE4, and get confused with some concept.
As official wiki and docs mentioned, UObject will be held and kept IF there is a UPROPERTY() class member refereced that. So,
(1) Seems that creating subcomps with CreateDefaultSubobject<>() does not required a UPROPERTY() ptrs to save them. Is that mean "Parent actor has already kept references somewhere"? Or some other reasons?
(2) If I create a component dynamically with NewObject<>() without saving it in a UPROPERTY() var, but then call RegisterComponent() immediately, IS IT A LEGAL WAY to use NewObject<>()?
(3) NewObject<>(this) , with the semantic of "DECLARED this AS OUTER", seems just like what CreateDefaultSubobject<>() does. But NewObject<>() requires that u have to EXPLICITLY declare some kind of "relationship" between the outer object and new object. So what makes them different, NewObject and CreateDefaultSubobject?
Since i'm pretty newbie to UE4, questions may be a little bit stupid...Any answer or comment will be much apprieciated!!
asked Oct 11 '17 at 09:14 AM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here