Questions about OnReset();

_markL

New member
I already wrote a few task and I never used OnReset on any of my task and I don't encounter any problems so far. So my question is:

1. What is the purpose of OnReset()?
2. What happen if I don't use it on my tasks?
3. And is there a better way to reset the variables other than manually assigning it? I mean if I have a
Code:
public SharedFloat speed = 5f;
, then I need to do
Code:
public override void OnReset()
{
    speed = 5f;
}
, what will happen if I mistakenly set it to a different float?

Thanks
 
OnReset only gets called within the editor when a task is initially added. So you're not really missing anything by not using it.

, what will happen if I mistakenly set it to a different float?
When OnReset gets called it will assign the value to that variable so the value doesn't have to match.
 
Ohh. Thanks. So just to be clear, OnReset() is only called the first time I add the task and never called in play mode? I just assumed that OnReset() are called when I exit the play mode.

P.S. Thanks for a really good support.
 
Top