Reply To: Have any way to know I click Stop Button ?

Slate Forums Support Have any way to know I click Stop Button ? Reply To: Have any way to know I click Stop Button ?

#793
jakin
Participant

I want to do is create GameObject once between click play button many times and click stop button once
1, create a GameObject when click play button first
2, do something like move, rotate…etc for GameObject when playing
3, click play button again when end and do not click stop button, in this case, GameObject just reset data, not need to destroy
4, click stop button and destroy GameObject

If check is
void OnReverse()
{
if (root.currentTime == 0) destroy GameObject;
else GameObject reset data;
}
There is a problem in step 3, OnReverse will be called and currentTime == 0, so GameObject will be destroyed..

Maybe add a global flag like isClickStop ?, set true when click stop button, set false when click play button
Then check change to
void OnReverse()
{
if (Cutscene.isClickStop) Destroy GameObject;
else GameObject reset data;
}