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"

Why doesn't my UObjects survive GC at compile?

Hello, I have a TArray of a UObject-derived class in an actor class I've written in code. The array is a UPROPERTY and the elements survive a restart of the editor. I create these objects and add them to the array in the editor by a Blutility method. I've created a blueprint that derives from my actor to customize some of the default values. What happens is, if I have an instance of this blueprint in the level and populate the array, I can't compile that blueprint anymore because those elements in the array all become null. I've checked and they are there until the compile.

So, why do they get garbage collected when I compile the blueprint?

Thanks in advance, Can Mert

Product Version: UE 4.8
more ▼

asked Jul 02 '15 at 05:12 PM in C++ Programming

avatar image

31 1 5 7

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

1 answer: sort voted first

Hello, Can

I am sorry to hear about the issue.

Please note that you can use RF_RootSet flag as an argument in NewObject method during the initialization of your UObject-derived classes. This will prevent objects from being garbage collected even if they are not referenced.

Also, if you have Editable-type specifiers in the array declaration, please try changing them to Visible (VisibleAnywhere, VisibleInstanceOnly, VisibleDefaultsOnly).

Hope this helped!


more ▼

answered Jul 02 '15 at 06:40 PM

avatar image

Andrii Melnyk
1.8k 60 19 112

avatar image Talemon Jul 02 '15 at 07:54 PM

Hey, thanks for the answer. I'll put the flag but I'm worried that if the error is in my code, there may be objects floating around with this flag. Otherwise, it is a bug in the editor code.
Also, yeah I've learned that there are things like that that should not be editable after a blueprint corruption case I've had a month ago.
Edit: I've put the flag and it's still happening. I get an Array of 72 NULLs :\

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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