Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

GC & UPROPERTY, working with CreateDefaultSubobject / NewObject

Hi there,

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!!


Product Version: UE 4.17
more ▼

asked Oct 11 '17 at 09:14 AM in C++ Programming

avatar image

3 2 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question