Announcement

Collapse
No announcement yet.

Are actor checks good on tick event happening every frame?

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

    Are actor checks good on tick event happening every frame?

    Good day community!

    I'm new and already exploring paper2d in UE4 but I have a question regarding checks on every tick. I have a blueprint that checks if the player has displaced by a distance, see my screenshot. The check happens every tick and was wondering if continuous checks of an object every tick has a heavy effect in performance? Is there another way to do the process more efficiently?

    Additional question, I placed that process in the player controller blueprint, is it good to populate the player controller?

    The screenshot was not finished yet but in the end it updates the old coordinates if it found to be more than 5 units traveled. Many thanks!
    Attached Files

    #2
    If it is a simple and not very complex game, this will not affect performance much. It is definitely recommended to use methods other than tick, especially when doing optimization.
    First, ask yourself whether it is necessary to perform this check in each frame (or, for example, 10 times per second).
    If you have to use this in tick at least get reference from "GetPlayerPawn" and "GetClass" and store it in variable.
    Where do you set "OldActorLocation" variable (also in tick)?

    Comment


      #3
      Originally posted by Mr. Wood View Post
      If it is a simple and not very complex game, this will not affect performance much. It is definitely recommended to use methods other than tick, especially when doing optimization.
      First, ask yourself whether it is necessary to perform this check in each frame (or, for example, 10 times per second).
      If you have to use this in tick at least get reference from "GetPlayerPawn" and "GetClass" and store it in variable.
      Where do you set "OldActorLocation" variable (also in tick)?
      Yes it is also set in tick if the distance required from the old to new location is met.

      That gave me an idea! How about if I make a Boolean that checks if the class is child of "this thing" in the begin play event, store it and put the Boolean check in the tick to process? Is there a way like to rerun the check in case the player changes a character? Another is that if I store the player pawn in the variable does it also updates every tick or it just put the states (say you stored me here at this location data I won't update this data anymore?) there?

      Well I'm trying to minimize everything already to the most as our target hardware are the low ends.

      Thanks a lot for the reply!!!

      Comment


        #4
        If you change the character you need also to set references again...and don't worry it will update location and all data also.
        For instance, GetPlayerCharacter -> store variable to "MyCharacter" and you can use that variable as references to get/set variables for that character, location, rotation etc.
        Certainly i don't think all this will affect performance much ... probably you won't even notice. But it's always better to have clean and optimized code and logic.

        Comment

        Working...
        X