Component being set to null after change

hello,
having a character set up in c++, i added a c++ component to it and initialized it in the constructor.

i.e:
SkillCastingComponent = CreateDefaultSubobject<USkillCastingComponent>(TEXT("SkillCastingComponent"));

the character is inherited in a blueprint.

Today i change few of the properties inside this component and built the project using VS.
after the build was successful, the output log in the editor pointed a warning the the reference will be nullptred and indeed, inside the blueprint derived from the character, the component’s details window is empty, and starting the game will cause a crash stating that SkillCastingComponent is null.

this is not the first time it happens.
in the first time it happened i deleted the character blueprint and created a new one.
in the rest of the times i changed the property name (i.e from SkillCastingComponent to SkillCastingComponent2) and it worked.

i cant keep doing this cause as you imagine, it will mess up the references inside the blueprint.
is there any way to avoid this?

How is your component SkillCastingComponent declared in your .h file? Is it a UPROPERTY and what settings do you use for that UPROPERTY?

thank you for replying.

UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
class GAMEPROTOTYPE_API USkillCastingComponent : public UActorComponent

and in the character class:

	/** Skill Casting Component */
	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Custom, meta = (AllowPrivateAccess = "true"))
	class USkillCastingComponent* SkillCastinggComponent;

still an issue
all this time and i didnt find a solution

It happened to me several times too. This is the problem of hot reload and whenever you edit a serialized data (UPROPERTY or UFUNCTION) in C++ there’s a chance for hot reload going wrong.

My way to avoid it is just being extra cautious when dealing with serialized data. For example closing the editor before compiling if the code involves UPROPERTY changes. Make separated commits for code and binaries.

Also if you can reproduce the issue consistently you should just send a bug report to Epic and let the engine team fix it.