I’m really getting to the end of my witts here…
I feel like I am always constantly having issues with blueprint corruption concerning components derrived from C++ classes. Basically I have Blueprints that derive from C++ classes. But sometimes when I change things about my C++ classes, or recompile my BP classes, maybe because I’ve migrated Unreal Versions, the components don’t get created anymore on spawn.
One example is from my AIController: I have an AHAIController
C++ class and some BP children, like my BP_PCAIController
. I was debugging weird pathfinding behaviour, and so I wanted to simply exchange the Pathfinding Component from UCrowdFollowingComponent
(that I’ve overwritten in the Constructor) to the default UPathFollowingComponent
.
From:
AHAIController::AHAIController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent")))
To:
AHAIController::AHAIController(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
The BP is still showing the Component, although, with an empty details pannel:
But on play, when the Controller is spawned, the component is missing, and hence a nullptr in C++:
Things that seem to fix that is reparenting the Blueprint or creating a new one and substituting the old one. But these solutions usually come with data loss and lots of work. Renaming the Component’s Property also works, although thats impossible for components like this, that are derived from Engine Classes.
I do not work with hot-reload as I am aware of the issues it can cause. I work with live coding, always close the editor before compiling.
How can I fix these issues, where do they come from, is there some way possible to completely rebuild the BP to fix this?
It can’t be the norm to recreate or reparent the BP avery time something changes about the parent C++ components, and transfer all the default values across and fix the graphs.