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"

How can I pass to SetTimer(..) as `InTimerMethod` parameter an method WITH PARAMETER?

How can I cheat the SetTimer(..) and pass a method WITH PARAMETER as InTimerMethod parameter of SetTimer(..)? Basically, it's all.

Below I've wrote, what I tried to do, but did not get result: Actually, SetTimer(..) wants only void f* (void). I've tried to declare void (void) delegate:

 DECLARE_DELEGATE(FMyDelegate);

Then, tried to call SetTimer(..) like this:

 int32 Parameter = 2;
 TManager.SetTimer(THandle, this, FMyDelegate::CreateUObject(this, &MyClass::MyMethod, Parameter), 10.f, true, 5.f);

MyMethod is declared like this:

 void MyClass::MyMethod(int32 Parameter);

But it looks like, it's impossible to pass delegate, whereas SetTimer(..) waits for pointer to function.

So I returns to my question: How can I feed the SetTimer(..) with MyMethod (which takes 1 parameter), passing this method as InTimerMethod parameter of SetTimer(..)?

Product Version: UE 4.9
Tags:
more ▼

asked Nov 09 '15 at 11:29 AM in C++ Programming

avatar image

Sashka
93 16 23 24

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

1 answer: sort voted first

=) It seems, I've found a solution of this problem, while I was writting the question - smiply use another overload of SetTimer(..) (2nd, not 4th), which takes namely delegate InDynDelegate parameter).

But I'm still currious: how can I get function ptr form delegate (to be able to call 4th overload of SetTimer(..), which wants function ptr as parameter?

more ▼

answered Nov 09 '15 at 11:42 AM

avatar image

Sashka
93 16 23 24

(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