I’m trying to do all possible programming from Animation Blueprint EventGraph in c++. I used this tutorial.
Here my codes:
.h
#pragma once
#include "Animation/AnimInstance.h"
#include "DDCharacterAnimInstance.generated.h"
UCLASS(Blueprintable, transient, BlueprintType)
class DD_FPS03_API UDDCharacterAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
bool isRunning;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Movement)
bool isFalling;
public:
APawn* owner;
UCharacterMovementComponent* movement;
virtual void NativeInitializeAnimation() override;
virtual void NativeUpdateAnimation(float DeltaSeconds) override;
};
.cpp
#include "DD_FPS03.h"
#include "DDCharacterAnimInstance.h"
void UDDCharacterAnimInstance::NativeInitializeAnimation()
{
Super::NativeInitializeAnimation();
owner = TryGetPawnOwner();
movement = Cast<UCharacterMovementComponent>(owner->GetMovementComponent());
}
void UDDCharacterAnimInstance::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
if(!owner || !movement) return;
isRunning = (owner->GetVelocity().SizeSquared() > 0.0f);
isFalling = (movement->MovementMode == MOVE_Falling);
}
After compiling everything works fine, but when I restart editor and try to open my Animations folder, editor crashes.
Error message:
LoginId:305a2b60d84f4b1684a02f8b48f09cbf
EpicAccountId:075b62921b9645b596c9570e05a7758f
SEGV_MAPERR at 0x0
UDDCharacterAnimInstance::NativeInitializeAnimation() Address = 0x1718b58c2 [/Users/david/Documents/Unreal Projects/DD_FPS03/Source/DD_FPS03/DDCharacterAnimInstance.cpp, line 11] [in UE4Editor-DD_FPS03.dylib]
UAnimInstance::InitializeAnimation() Address = 0x10b897a97 (filename not found) [in UE4Editor-Engine.dylib]
USkeletalMeshComponent::InitializeAnimScriptInstance(bool) Address = 0x10bd1d3ce (filename not found) [in UE4Editor-Engine.dylib]
USkeletalMeshComponent::InitAnim(bool) Address = 0x10bd1b12e (filename not found) [in UE4Editor-Engine.dylib]
USkeletalMeshComponent::SetAnimInstanceClass(UClass*) Address = 0x10bd2ee11 (filename not found) [in UE4Editor-Engine.dylib]
FAnimBlueprintThumbnailScene::SetAnimBlueprint(UAnimBlueprint*) Address = 0x11268a606 (filename not found) [in UE4Editor-UnrealEd.dylib]
UAnimBlueprintThumbnailRenderer::Draw(UObject*, int, int, unsigned int, unsigned int, FRenderTarget*, FCanvas*) Address = 0x112690046 (filename not found) [in UE4Editor-UnrealEd.dylib]
ThumbnailTools::RenderThumbnail(UObject*, unsigned int, unsigned int, ThumbnailTools::EThumbnailTextureFlushMode::Type, FTextureRenderTargetResource*, FObjectThumbnail*) Address = 0x112219fba (filename not found) [in UE4Editor-UnrealEd.dylib]
FAssetThumbnailPool::Tick(float) Address = 0x11155a585 (filename not found) [in UE4Editor-UnrealEd.dylib]
UEditorEngine::Tick(float, bool) Address = 0x111a7bd56 (filename not found) [in UE4Editor-UnrealEd.dylib]
UUnrealEdEngine::Tick(float, bool) Address = 0x1126e653c (filename not found) [in UE4Editor-UnrealEd.dylib]
FEngineLoop::Tick() Address = 0x10a1143f9 (filename not found) [in UE4Editor]
GuardedMain(wchar_t const*) Address = 0x10a11bba2 (filename not found) [in UE4Editor]
-[UE4AppDelegate runGameThread:] Address = 0x10a12953c (filename not found) [in UE4Editor]
-[FCocoaGameThread main] Address = 0x10a356366 (filename not found) [in UE4Editor-Core.dylib]
Unknown() Address = 0x7fff9e1cac6d (filename not found) [in Foundation]
_pthread_body Address = 0x7fffb1f9baab (filename not found) [in libsystem_pthread.dylib]
_pthread_body Address = 0x7fffb1f9b9f7 (filename not found) [in libsystem_pthread.dylib]
thread_start Address = 0x7fffb1f9b1fd (filename not found) [in libsystem_pthread.dylib]
Any ideas how to fix it? Compiles clearly.