N
N
NickName73312018-03-09 21:45:44
C++ / C#
NickName7331, 2018-03-09 21:45:44

Unity (C#) - How to execute Invoke 1 time in Update?

You need to execute Invoke() once in Update. But since Update is updated every frame, the function is called every frame. Is it possible to implement this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2018-03-09
@NickName7331

the most obvious .. that you do not need to do this in the update .. but on some kind of event.
otherwise, if you really need to, then usually they just set a boolean flag that the action has already been completed

void Update()
{
 if(!once)
 {
 once = true;
 //invoke here
 }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question