Hello,
I already got some Access Violation but I can’t figure out why I get one this one time.
On VS Debug I got a this was nullptr error, but I don’t use pointer in the method so I don’t get why I get it. And on error stacks side, I got an Access Violation.
The problem is here (AC_MovementManager.cpp):
void UAC_MovementManager::SetMovementMode(const EMovementEnum& NewValue)
{
if (MovementMode == NewValue) return; // It crashes here
PrevMovementMode = MovementMode;
MovementMode = NewValue;
OnMovementModeChanged();
}
Here is the previous stack (LabyrinthCharacter.cpp):
void ALabyrinthCharacter::OnMovementModeChanged(EMovementMode PrevMovementMode, uint8 PreviousCustomMode)
{
Super::OnMovementModeChanged(PrevMovementMode, PreviousCustomMode);
if (CharacterMovement->MovementMode == MOVE_Walking || CharacterMovement->MovementMode == MOVE_NavWalking) MovementComponent->SetMovementMode(EMovementEnum::MM_Grounded);
else if (CharacterMovement->MovementMode == MOVE_Falling) MovementComponent->SetMovementMode(EMovementEnum::MM_Falling);
}
MovementMode is declared as below (AC_MovementManager.h):
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "State Values")
EMovementEnum MovementMode;
and initialized as EMovementEnum::MM_Grounded in UAC_MovementManager() (constructor).
EMovementEnum is declared (and included) in a separate header as following:
UENUM(BlueprintType)
enum class EMovementEnum : uint8
{
MM_None UMETA(DisplayName = "None"),
MM_Grounded UMETA(DisplayName = "Grounded"),
MM_Falling UMETA(DisplayName = "Falling"),
MM_Ragdoll UMETA(DisplayName = "Ragdoll")
};