I am curious if this is correct practice:
- I create UObject* in background thread and then add it to root at the begin of my function:
UCell* StartCell = NewObject<UCell>();
StartCell->AddToRoot();
StartCell->Initialize(Start, nullptr, 0.f, 0.f);
- As the function runs, i create more objects like this:
UCell* Neighbour = NewObject<UCell>(Cell);
where “Cell” is the previous element in chain (StartCell is the first)
- At the end of the function:
StartCell->RemoveFromRoot();
I am curious if this is the correct, and will the other cells get picked up by the garbage collector eventually