Announcement

Collapse
No announcement yet.

UTimelineComponent not executing update function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    UTimelineComponent not executing update function

    Hello,
    I am having issues in UE4.20.2 where my TimelineUpdate function is never getting called when I play the Timeline. I am checking the timeline in the debugger right before I call Play() and I see the RecoilUpdate function under the InterpFloats so it is added to the timeline. (Image about debugger attached to post)


    My header file has the following functions/variables:
    Code:
        UTimelineComponent* RecoilTimeline;
    
        UPROPERTY(EditDefaultsOnly, Category = "Recoil")
        UCurveFloat* Curve;
    
        FOnTimelineFloat TimelineUpdate{};
        FOnTimelineEvent TimelineFinished{};
    
        void RecoilUpdate(float Value);
    
        void RecoilFinished();
    My cpp file has the following functions:

    Code:
    ASWeapon::ASWeapon()
    {
    RecoilTimeline = NewObject<UTimelineComponent>(this, FName("TimelineAnimation"));
    }
    void ASWeapon::BeginPlay()
    {
        Super::BeginPlay();
    
        if (Curve)
        {
            TimelineUpdate.BindUFunction(this, FName{ TEXT("RecoilUpdate") });
            TimelineFinished.BindUFunction(this, FName{ TEXT("RecoilFinished") });
            SCREEN_LOG_DETAILED(TEXT("Curve Assigned to timeline"));
            RecoilTimeline->AddInterpFloat(Curve, TimelineUpdate, FName{ TEXT("Value") });
            RecoilTimeline->SetTimelineFinishedFunc(TimelineFinished);
            RecoilTimeline->SetLooping(false);
            RecoilTimeline->RegisterComponent();
        }
    
    }
    
    void ASWeapon::RecoilUpdate(float Value)
    {
        SCREEN_LOG_DETAILED(TEXT("Recoil Update"));
    }
    
    void ASWeapon::RecoilFinished()
    {
        SCREEN_LOG_DETAILED(TEXT("Recoil Finished"));
    }
    
    void ASWeapon::PlayFireEffects() {
    
    RecoilTimeline->Play();
    }
    }
    PlayFireEffects gets called and calls the Play function but nothing else gets called. The debugger snapshot attached shows the function inside the timelime. Any help would be greatly appreciated. Thanks.

    #2
    Assuming you verified curve is set?
    https://www.casualdistractiongames.com

    Comment


      #3
      Originally posted by OptimisticMonkey View Post
      Assuming you verified curve is set?
      Yeah I added the curve from blueprints and it is populated when I checked the debugger.

      Comment

      Working...
      X