Can inheritance hierarchies be changed after a class is generated?

I have different classes for my player character, NPCs, and enemies, each of which inherits from ACharacter. I realized after I already implemented a bunch of stuff that it would be a better idea to make all three classes inherit from some common ABaseCharacter class. In each character class’s header, I have some variation of this:


UCLASS()
class MYGAME_API APlayerCharacter : public ACharacter

Is there anything wrong with simply changing public ACharacter to public ABaseCharacter and recompiling, or do I need to manually delete every character class, create ABaseCharacter, use the editor to right click on ABaseCharacter and manually select “Create C++ class derived from ABaseCharacter”, and let the editor build and link it internally?

As long as ABaseCharacter exists you should be fine (if you haven’t tried it already)

I sometimes find hot reload will crash after a change like that, so personally I’d close the editor, recompile, and reopen.

That’s really helpful, thank you! I was concerned I would break something if I didn’t do the whole “delete everything > compile > new class > compile > manually create children > compile” dance :slight_smile: