Crash after changing C++ from Actor to Component

Hey guys,

I wanted to Report a bug:

When I create a Class which derives from AActor and place it in the World and Change this Actor afterwards to a USceneComponent the Engine crashes and doesn’t load the map anymore.

The is in the Level.cpp (Line 762) where the AttachedDepth is calculated.

StableSortInternal(Actors.GetData(), Actors.Num(), [&](AActor* L, AActor* R) {
		return CalcAttachDepth(L) < CalcAttachDepth(R);
});

I debugged this and saw that L is my previous Actor which is now a SceneComponent

Hey McStrife-

Components alone are not meant to be added to the viewport. The is occurring when the level attempts to process the “actor” that was placed but can’t recognize it. Changing the type of a class (Actor, Character, SceneComponent, etc.) after creating it is not a supported workflow. If you change the class back to Actor, you should be able to open the map again.

Cheers

Hey ,
yes I know.
But I would say that the Engine should make sure that IF a component is placed in world

  1. that Component should be deleted.
    or
  2. that Component should be wrapped into an Empty Actor as a Child of his RootComponent

The Problem in my case is that changing the Component back to an Actor would take some time because this Component is a BaseClass of many other COmponents :stuck_out_tongue:

Thanks for you answer

The editor already protects against components in the world by preventing the ability to add them directly. This workflow is a workaround to this protection which the editor responds with by closing. If converting the component class to an actor is not an option, you could create a new class with the functionality of your component class. If you reparent the other components, at least temporarily, to this new class, you should then be able to remove/edit the original.

Thanks for you help ,

but in my opinion it’s still a bug.
I just wanted to help you guys :slight_smile: