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"

Handling A TArray(FTimerHandle) on Finished Timers

Hello,

I'm making a component that handles tracing data. The user can input Trace-Data to be started. I want it to have 3 models of Tracing: Single, Timed (Running on Timer Trigger by Timers), Timed(Running every Tick by Tick). The setup works well when dealing with a single instance of said information (the variables are stored in an FStruct). At the end of each Tracing's process, the Saved Tracing and Timer Data are respectively deleted.

From this, I am in the process of making it TArray Compatible. Both the Single and Tick Based ones already work; however, I am somewhat stuck for the Timer One since On-Timer Finalization there's no direct way to really know which Array Item was the one that finished. I mean this because I wish to make this system as dynamic as possible; this meaning that the user can add as many Array Items as needed and the SetTimer that I use utilizes void(void) functions as outputs (delegates could work but the events wouldn't fire within said component).

Like the single instance one, upon Timer finishing, I would need to know how to split the data and determine which timer was the one that finished (without adding a limit to the amount of timer-based Items that there can be).

At the moment, I have an FStruct that stores an FTimerHandler and an integer (Which tracks which respective Trace Data Array-Item is used by). I've looked at https://api.unrealengine.com/INT/API/Runtime/Engine/FTimerManager/ but can't seem to find what I'm looking for/a way to implement from it.

What do you recommend / suggest? Thanks!

Product Version: UE 4.20
Tags:
more ▼

asked May 20 '19 at 11:42 PM in C++ Programming

avatar image

me4dinosaur
255 15 17 21

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

You can send argument to binded function, by creating custom FTimerDelegate, like this:

 FTimerDelegate MyDelegate = FTimerDelegate::CreateUObject( this, &AMyClass::MyFunction, MyArgument, MyOtherArgument ); // you can plug more or less arguments in

Then put that delegate in SetTimer.

Also "delegates could work but the events wouldn't fire within said component", the this part that you point function to call is the object that delegate/timer will call saying this means it will call object that set the timer/delegate. So make sure you point to those components in order for timer to call them.

more ▼

answered May 20 '19 at 11:59 PM

avatar image

Shadowriver
36.7k 932 169 1111

avatar image me4dinosaur May 22 '19 at 03:59 AM

Okay, I think I get the idea. So I include this created object within the declaration of the timer? Do I need to store this Object in a standard variable?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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