Download

Animation in C++

Hello,

i don’t understand how animations works in C++,

i do this :

.h



	UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "SkeletalMesh")
			USkeletalMeshComponent  *PLAYER1;
	UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "UAnimSequence")
		UAnimSequence* Anim;

	bool g_in;


.cpp



	PLAYER1 = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT("player_1"));
	static ConstructorHelpers::FObjectFinder<UAnimSequence> anim(TEXT("/Game/CHARACTERS/player/running"));
        if(anim.Object){Anim = anim.Object;}


//in tick function

    if (!g_in)
    {
			if(Anim)
                        {
                                //these lines close the application
				PLAYER1->SetAnimationMode(EAnimationMode::AnimationSingleNode);
				PLAYER1->SetAnimation(Anim);
				PLAYER1->Play(true);
			}
                        g_in = true;
    }


And that’s close application, i search for a long time in some forums but i still don’t understand, thanks all !