Announcement

Collapse
No announcement yet.

Really basic question...How do you define how often a Tick function is ran in code?

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

    Really basic question...How do you define how often a Tick function is ran in code?

    I override Tick(DeltaSeconds) for my class...

    IE Where do I define DeltaSeconds such that my Tick function runs every 1 second instead of every frame?

    #2
    You can't do what. It's supposed to be the way it is. Like the Update()-call in Unity or every other game engine.
    But instead you can build your self a timer.

    Declare a float variable "timer" or something like that in your class and then in your Tick() function do:

    Code:
    timer += DeltaSeconds;
    
    if (timer >= 1.0f) {
       // your actions that should happen every second;
       timer = 0.0f;
    }

    Comment


      #3
      Originally posted by Voutan View Post
      You can't do what. It's supposed to be the way it is. Like the Update()-call in Unity or every other game engine.
      But instead you can build your self a timer.

      Declare a float variable "timer" or something like that in your class and then in your Tick() function do:

      Code:
      timer += DeltaSeconds;
      
      if (timer >= 1.0f) {
         // your actions that should happen every second;
         timer = 0.0f;
      }

      Ah...I was under the assumption that UE4 had something like this built in. A Dev in another thread told me that I could designate how often my Tick function runs...

      Comment


        #4
        Well, i didn't stumble about that yet, but if a dev says so, then there should be a way^^
        Do you have a link to the thread?
        Last edited by Voutan; 04-07-2014, 03:57 PM.

        Comment


          #5
          Nop, there is no way to do that. Tick happens every frame, and i can't even imagine any engine using ticks with a second basis. Use timers to call your function each N seconds.
          https://docs.unrealengine.com/latest...ing/index.html
          https://docs.unrealengine.com/latest...ers/index.html
          Alone: The Untold - a story driven horror game

          Comment


            #6
            Originally posted by BiggestSmile View Post
            Nop, there is no way to do that. Tick happens every frame, and i can't even imagine any engine using ticks with a second basis. Use timers to call your function each N seconds.
            https://docs.unrealengine.com/latest...ing/index.html
            https://docs.unrealengine.com/latest...ers/index.html
            Ok thanks...

            I can't find the thread, but it was about BTServices. You can set an Interval and it's suppose to run the Service on that Interval. However, mine simply ran every frame regardless of what I set my Interval to.

            Comment


              #7
              Usuaully deltaTime means that's the time between frames. So 1sec/30frames = 0.033 (30 fps).

              I do believe it is possible to alter it via TimeDilation. Probably for slomo effects (I think that was how folks used it in old Unreal modding days)

              See comments, etc
              /** Allow each actor to run at a different time speed. The DeltaTime for a frame is multiplied by the global TimeDilation (in WorldSettings) and this CustomTimeDilation for this actor's tick. */

              Check it out. I havent used it yet. Just searched the code right fast
              Godz for UT '99 / UT 2003

              Comment


                #8
                The best way to do what you want is with the TimerManager, use the second link that Biggest posted and it should work well

                Comment

                Working...
                X