Announcement

Collapse
No announcement yet.

Timers and Delay Node.

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

    Timers and Delay Node.

    I am trying to write a function using a timer in such a way that is easily done with a delay node but I am not quite sure if it is going to do what I want it to. I want to apply if necessary some modifications to a player then skip a frame so that I can be sure that the modifications are applied.

    HandleOnGameLoaded()
    {
    bool bIsTimerActive = IsTimerActive(TimerHandle_Delay);

    if(!TimerHandle_Delay)
    {
    GameMode = GetAuthGameMode();

    if(GameMode)
    {
    .....do something;
    SetTimer(TimerHandle_Delay, this, &CLASS::HandleOnGameLoaded, 0.0f, false);
    }
    }
    else
    {
    ClearTimer(TimerHandle_Delay);

    }
    }


    I stripped the function down obviously. will this do what i described?

    #2
    Yesterday i read a post from a guy, saying that with blueprints a timer with 0.0f won't call the function at all.
    So, may be you should add something there.
    | Home | ShootOut (WIP) |

    Comment


      #3
      You can use FTimerManager::SetTimerForNextTick() to delay for one frame. Using 0.f will cause the timer to not be called at all.

      https://docs.unrealengine.com/en-US/...k/4/index.html

      Comment


        #4
        Originally posted by TheJamsh View Post
        You can use FTimerManager::SetTimerForNextTick() to delay for one frame. Using 0.f will cause the timer to not be called at all.

        https://docs.unrealengine.com/en-US/...k/4/index.html
        Thumb up !
        | Home | ShootOut (WIP) |

        Comment


          #5
          Originally posted by silik1 View Post
          Yesterday i read a post from a guy, saying that with blueprints a timer with 0.0f won't call the function at all.
          So, may be you should add something there.
          Thank you for the post and insight silik1!

          Comment


            #6
            Originally posted by TheJamsh View Post
            You can use FTimerManager::SetTimerForNextTick() to delay for one frame. Using 0.f will cause the timer to not be called at all.

            https://docs.unrealengine.com/en-US/...k/4/index.html
            thank you for the solution TheJamsh!

            Comment

            Working...
            X