Have any way to know I click Stop Button ?

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #791
    jakin
    Participant

    I want to do below things..
    1, Destroy Object in OnReverse() called by click Stop Button
    2, Do not Destroy Object, just reset data in OnReverse() called by not click Stop Button

    But, I have no idea to know OnReverse() is called by click stop button or not….

    #792
    Gavalakis
    Keymaster

    Hey,

    The closest thing to what you are after, could be done by checking if ‘root.currentTime == 0’. When the Stop button in the editor is clicked or the cutscene is anyhow rewinded, the cutscene is sampled at time 0.

    Let me know if that works for you.

    Join us on Discord: https://discord.gg/97q2Rjh

    #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;
    }

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.