- Home /
Question by
scottstephan · Jun 06, 2013 at 01:21 AM ·
updatesendmessageawake
Adding a function to update
Kind of new to C#, or at least to not coding like a dummy. Here's a question: I have a function I'd like to update every frame, but only under certain circumstances. I could SendMessage from a dispatch every frame, but that seems expensive and odd.
What I'd like to do is: SendMessage(startUpdateEveryFrame) and later, SendMessage(stopUpdateEveryFrame). Will awake help me do that? What are my best practices here?
Comment
Why do you need Send$$anonymous$$essage? Just call the function directly
As to practices. It really depends on what you are doing and other circumastances
Answer by MiKo51 · Jun 06, 2013 at 02:29 AM
bool updateEveryFrame=false;
void Update()
{
if (updateEveryFrame)
{
CallYourFunction();
}
}
Your answer