x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Use FTickFunctions or override Tick

Hi,

in my current project I started using FTickFunctions over just adding stuff to Tick() for more complex calculations. But I'm still not sure whether that's the best idea. Is there any downside performance- or otherwise to it? I can mostly think of upsides like no need to worry about engine updates that change the normal Tick() and keeping the Tick() small and clean. It is a little more complex, though, because I need to register the function in RegisterComponentTickFunctions().

Is there anything I have to keep in mind when using FTickFunctions? Should I avoid them or use them more often?

Thanks

Product Version: Not Selected
Tags:
more ▼

asked Dec 05 '16 at 11:19 AM in C++ Programming

avatar image

Choba
11 1 3 5

avatar image iniside Mar 05 '17 at 08:06 AM

How did you added another Tick function to component ? I tried to do it, but it constantly crashes ;/.

https://forums.unrealengine.com/showthread.php?138663-My-custom-tick-function-in-component-doesn-t-work

avatar image Choba Mar 06 '17 at 09:17 AM

Hm, the only difference I see at the moment is that I check the TickType before I do anything with Target in ExecuteTick... So maybe Target isn't valid yet or something:

 void FQuadCharacterMovementComponentAutoJumpObstaclesTickFunction::ExecuteTick(float DeltaTime, enum ELevelTick TickType, ENamedThreads::Type CurrentThread, const FGraphEventRef& MyCompletionGraphEvent)
 {
     if ((TickType == LEVELTICK_All) && Target && !Target->IsPendingKillOrUnreachable())
     {
         FScopeCycleCounterUObject ComponentScope(Target);
         FScopeCycleCounterUObject AdditionalScope(Target->AdditionalStatObject());
         Target->AutoJumpObstaclesTick(DeltaTime, *this);
     }
 }

EDIT: oh, and my ReigsterComponentTickFunctions is different:

 if (bRegister)
         {
             if (SetupActorComponentTickFunction(&AutoJumpObstaclesTickFunction))
             {
                 AutoJumpObstaclesTickFunction.Target = this;
             }
         }
         else
         {
             if (AutoJumpObstaclesTickFunction.IsTickFunctionRegistered())
             {
                 AutoJumpObstaclesTickFunction.UnRegisterTickFunction();
             }
         }
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question