ASkeletalMeshActor doesn't Tick

Hi,
I posted this question yesterday in the AnswerHub, but it didn’t get any attention and now it’s already gone so deep in the list that it won’t get any more attention. But I’m still stuck with that problem! I could use some help or advice on this. :wink:

I created a C++ class based on ASkeletalMeshActor, called MySkeletalMeshActor. I then created a BluePrint based on this C++, called MySkeletalMeshActor_BP

In the C++ class, I have overridden the BeginPlay and Tick methods, without forgetting to call Super:: for each of these methods. For the moment, these methods are only supposed to log a message, allowing me to check everything is fine.

Result
Only the BeginPlay() log is visible in the console. The Tick() method doesn’t do anything.

MySkeletalMeshActor.h


 

  1. #pragma once
  1. #include "CoreMinimal.h"
  1. #include "Animation/SkeletalMeshActor.h"
  1. #include "MySkeletalMeshActor.generated.h"
  1. UCLASS()
  1. class UNNAMED_API AMySkeletalMeshActor : public ASkeletalMeshActor
  1. {
  1. GENERATED_BODY()
  1. protected:
  1. // Called when the game starts
  1. virtual void BeginPlay() override;
  1. virtual void Tick(float DeltaTime) override;
  1. };

 

MySkeletalMeshActor.cpp


 

  1. #include "MySkeletalMeshActor.h"
  1. void AMySkeletalMeshActor::BeginPlay()
  1. {
  1. Super::BeginPlay();
  1. UE_LOG(LogTemp, Warning, TEXT("Begin Play"));
  1. }
  1. void AMySkeletalMeshActor::Tick(float DeltaTime)
  1. {
  1. Super::Tick(DeltaTime);
  1. UE_LOG(LogTemp, Warning, TEXT("Tick"));
  1. }

 

In the BluePrint, Tick is enabled:

Anybody knows what is wrong with SkeletalMeshActor Tick() method ?

Thak you!

Try these in the constructor:



 // set this actor to call Tick() every frame
 PrimaryActorTick.bCanEverTick = true;
 PrimaryActorTick.bStartWithTickEnabled = true;


Thank for your suggestion. That works!
Actually, only the line** PrimaryActorTick.bCanEverTick = true;** was enough.

So, for those who could encounter the same problem, the full solution requires to overload the constructor, since the generated code for ASkeletalMeshActor doesn’t include the constructor.

Thus, in MySkeletalMeshActor.h I added this:


public:
    AMySkeletalMeshActor();

And in MySkeletalMeshActor.cpp I added this:


AMySkeletalMeshActor::AMySkeletalMeshActor() 
{
    PrimaryActorTick.bCanEverTick = true;
}

And everything works perfectly!
​​​​​​​Thanks again!