Currently have code that causes SetWorldLocation to freeze the editor. Not sure whats causing this issue.
for (int i = 0; i < MAX_NUM; i++) {
UOObject* obj= NewObject<UOObject>(this, UOObject::StaticClass());
obj->id = obj_counter;
obj->parent_id = objs[current_obj_index]->id;
obj->box = generate_box(objs[current_obj_index]->bbox, i + 1);
obj->RegisterComponent();
if (IsValid(obj))
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Green, TEXT("obj is Valid")); //<-- This executes
else
GEngine->AddOnScreenDebugMessage(-1, 15.f, FColor::Yellow, TEXT("obj is NOT Valid, pending deletion"));
obj->SetWorldLocation(FVector(obj->box.origin.X, obj->box.origin.Y, obj->box.origin.Z)); // <-- Problematic code
// ...
// ...
}
UOObject
in this context inherits from UBoxComponent. This code is in a function that is part of an actor class. The function, generate_box, generates valid numerical data and IsValid
indicates the object is valid and is not pending for destruction. Attempted to use
AttachToComponent();
AttachToComponent(objs[current_obj_index]->id, FAttachmentTransformRules::KeepWorldTransform);
and even attempted:
AttachToComponent(RootComponent, FAttachmentTransformRules::KeepWorldTransform);
//Constructor code
root_component = CreateDefaultSubobject<USceneComponent>(TEXT("root"));
RootComponent = root_component;
Both instances lead to a temporary freeze then offsets the world objects (which is surprising because KeepWorldTransform would imply world coordinates would be used)
Not sure whats causing this issue. Any ideas?