NEED HELP: Getting My Locomotion System in Master Character to work with Derives

Don’t tell me to use AI. It doesn’t know how to help me too.

First things first: I created Master Character Class, that has my Locomotion System assigned upon initializing.


void ACndCharacter_Master::BPF_Init_SetupComponents()
{

ACO_ELS = CreateDefaultSubobject<UCndComp_LocomotionSystem>(ACndCharacter_Master::CompName_LocomotionSys);

}

I created Player Character Class, parented to Master Character class.

UCLASS()
class PROJECT_API ACndCharacter_Player : public ACndCharacter_Master

I tried using Begin Play, inside Player to get the locomotion system initialized and working.

void ACndCharacter_Player::BPF_BPlay_SetupComponents()
{

	// Ensure Locomotion System is valid and assign its owner
	if (ACO_ELS)
	{

		ACO_ELS->BPF_SetOwner(this); // Assign this player as the owner

	}

}

void UCndComp_LocomotionSystem::BPF_SetOwner(AActor* ACO_NewOwner)
{

	// Assign the owner
	ACO_Owner = ACO_NewOwner;

	// Try to cast the owner to ACndCharacter_Master
	CndCharacter_Target = Cast<ACndCharacter_Master>(ACO_Owner);

	// Debug message to confirm the assignment
	if (CndCharacter_Target)
	{
		UE_LOG(LogTemp, Log, TEXT("Owner assigned successfully: %s"), *CndCharacter_Target->GetName());
	}
	else
	{
		UE_LOG(LogTemp, Error, TEXT("Failed to assign owner!"));
	}


}

I wanted to make things easy, parenting things from Master, but can’t get this to work from Player.
Trying to fire one of the functions from Player crashes the engine (of course, because of missing “ifs” in the Locomotion Component Script (if (CndCharacter_Target) = Is Valid)) that could’ve prevented them.

	if (CndCharacter_Target) // Is Valid?
	{

	}