C++ Actor changing parent class loses Location information

Guys I’m really in trouble. I have a C++ class called InteractableObject, which was derived from AActor. I placed many of those items in levels. all works fine. Now I need to put another class in between, called ApsItemActor, which is anyway derived from AActor.

So I go from: AActor → InteractableObject
to: AActor → ApsItemActor → InteractableObject

When I do this all items placed in the levels are moved to 0,0,0 like if the position cannot be read anymore from the map for those objects.
If I cannot solve it somehow, means I have to reposition all the objects, and its hundreds of them.

I’m on 4.27.2-release.

Hi, I figured out a solution for this problem. The solution is to:

  • keep the Parent class as AActor
  • then open the editor
  • load all your maps
  • in C++ change the parent class to the new class (in my case ApsItemActor)
  • the hot reload will be generated (because the editor is open) and the updated class will be loaded by the editor
  • you will see a message that the level has changed, but all the objects should be in the right place
  • save the level now

For some levels I had to redo the operation only with one level loaded, I am not sure why.

This workaround worked for me.