I’m getting an access violation while trying to switch my animbp from blueprint to c++. I made it derived from a C++ file i created and I wanted to use root motion for my character dodging on network and what not. When I run it on BP, it works. But i feel so limited. Theres so much more i want to do and i know how to do it on C++. But when I try to create my anim instance, the engine keeps crashing as soon as I bind my character to the C++ anim instance. Everything compiles normally too so its kinda difficult to find the bug. Can someone please take a look and see if they can find it?
#include "MyAnimNotifyStateMovement.h"
#include "Engine.h"
#include "initPlayer.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "Components/InputComponent.h"
void UMyAnimNotifyStateMovement::NotifyBegin(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float TotalDuration)
{
playerRef = Cast<Ainitplayer>(Ainitplayer::StaticClass());
if (playerRef != nullptr) {
}
}
void UMyAnimNotifyStateMovement::NotifyTick(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation, float FrameDeltaTime)
{
GEngine->AddOnScreenDebugMessage(-1, 4.5f, FColor::Yellow, __FUNCTION__);
}
void UMyAnimNotifyStateMovement::NotifyEnd(USkeletalMeshComponent* MeshComp, UAnimSequenceBase* Animation)
{
playerRef = Cast<Ainitplayer>(Ainitplayer::StaticClass());
if (playerRef != nullptr) {
playerRef->GetCharacterMovement()->MovementState.bCanWalk;
playerRef->movement = EPlayerMovement::isWalking;
}
}
as for the error, here is what im getting:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000710
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_CoreUObject
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_CoreUObject
UE4Editor_CoreUObject
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_Engine
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_PropertyEditor
UE4Editor_DetailCustomizations
UE4Editor_DetailCustomizations
UE4Editor_ClassViewer
UE4Editor_ClassViewer
UE4Editor_ClassViewer
UE4Editor_ClassViewer
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_ApplicationCore
UE4Editor_ApplicationCore
UE4Editor_ApplicationCore
UE4Editor_ApplicationCore
user32
user32
UE4Editor_ApplicationCore
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll