I keep getting “(UnrealEditor-Engine.dll) in UnrealEditor.exe: 0xC0000005” read access violation error in this finction. The class is inherited from Character class
#include "AIController.h"
#include "Components/SkeletalMeshComponent.h"
#include "PhysicsEngine/PhysicalAnimationComponent.h"
#include "Components/CapsuleComponent.h"
...
void ACPP_EnemyBase::Die()
{
bIsDead = true;
AIController->UnPossess();
GetMesh()->bPauseAnims = true;
PhysicalAnimationComponent->ApplyPhysicalAnimationProfileBelow(BoneNamePA, FName("Falling"), false);
GetMesh()->SetAllBodiesBelowSimulatePhysics(BoneName, true); //Here
GetCapsuleComponent()->SetCollisionEnabled(ECollisionEnabled::NoCollision); //Or here
}
I tried storing mesh and capsule components in variables but it didn’t help