x

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"

How can I destroy an Object from Root Set?

Hello,

I would like to ask how to destroy objects from Root Set (explicitly marked with RF_RootSet), as calling MarkPendingKill() throws an exception at assert: check(!IsRooted()). It seems that those objects cannot be deleted that way and I would like to know if removing RF_RootSet flag and then calling MarkPendingKill() is safe.

Thank in advance, cloud

Product Version: Not Selected
Tags:
more ▼

asked Jun 08 '14 at 10:49 PM in C++ Programming

avatar image

cloud
28 5 10 13

avatar image cloud Jun 08 '14 at 11:44 PM

It seems that removing RF_RootSet is working but it's important to remember that "Outer" has to be set to default value as changing that will cause the chain of references to point to our object and will throw an exception during GC.

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

1 answer: sort voted first

UPROPERTY()

why are you using root set ?to prevent GC?

I'd recommend just using UPROPERTY() for GC protection and not using the Root set

when I restart levels or change levels with actors I made part of the root set the game frequently crashed

Rama

more ▼

answered Jun 09 '14 at 01:20 AM

avatar image

Rama
10.6k 446 346 1088

avatar image cloud Jun 09 '14 at 11:33 AM

I have class OrderQueue which is an array of instances of class derived from UObject in every unit in game (array of orders for units).

  1. If I change OrderQueue to: UCLASS() UOrderQueue : public TArray {..} and use UPROPERTY() to mark that variable in unit, my orders will be properly GC (that is they will not be destroyed as long as they are in the array)?

  2. If I mark TArray variable with UPROPERTY(), orders will be correctly GC (is UPROPERTY() on TArray enough and I don't have to worry about using UPROPERTY() on UOrder)?

avatar image mirrorlink Jun 12 '17 at 05:04 PM

Hey @Rama, does this work for UPackage? Because Im using LoadPackageAsync as a form of caching the new level to be opened (I cant use streaming levels because i want to change the game mode, player controller and such).

(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