playMaker

Author Topic: Some actions wont 'finish'[SOLVED]  (Read 4434 times)

meerkatinvasion

  • Playmaker Newbie
  • *
  • Posts: 4
Some actions wont 'finish'[SOLVED]
« on: July 13, 2020, 10:30:32 AM »
    Hello, I've been struggling with a problem for some time and after extensive googling and trial & error I'm stumped.

    The short description of the problem is I have a state, which certain actions somehow prevent from triggering the "finished" event.

    The longer description is as follows:

Background:On a gameobject I have a MOUSE OVER and MOUSE EXIT global transitions. The first state in MOUSE OVER detects if the player has clicked on the object. Once a click is detected the next state compares the name of the clicked gameobject to another one in the scene, and if it is the same it triggers the "correct" transition. The "correct" transition leads to an event called animation; which in term leads to an event called "correct item sequence". So it's MOUSE OVER(CLICKED) > CHECK NAME > ANIMATION > CORRECT ITEM SEQUENCE

The problem: the state machine called "animation" won't finish if there are certain actions in it (e.g. DOTween actions, Wait), so the "correct item sequence" never starts.

Extra info & things I tried:
  • During prototyping the animation state did not exist and the "correct" event lead directly to the correct item sequence and it was working properly.
  • I deleted all actions from the animation state and put in a Set Bool Value action and created a boolean variable called Debug. This worked, the variable was set and state finished.
  • I deleted all actions from the animation state and put in a simple "Wait" action with 1 second. The same problem - the state did not finish.
  • When I put in a DOTween Transform Move action, the tween animation happens, visually it appears to be completed but the state never finishes.
  • I tried leaving the Finish Event empty and putting in a FINISHED transition, setting a custom finish event and setting the finish event to FINISHED. None of this worked.

Since I could replicate the problem with a simple Wait action leads me to think that the problem is caused by actions that do not immediately resolve; like waiting a tweening animation to complete. But I how no idea why that might cause an issue, or how I can fix it. Help is much appreciated![/list]
« Last Edit: July 14, 2020, 10:22:41 AM by meerkatinvasion »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Some actions wont 'finish'
« Reply #1 on: July 13, 2020, 01:49:02 PM »
Hi.
A Wait action Should Stay in the state until the wait time that has been set has been passed (or a different action has send a event).

But if you have time scale set to 0 (for example if you open a menu you could be setting time scale to 0)
Then the time wont run, unless you checked 'Real Time'

The Dotween also probably has a certain time to do its tween, so it will also stay in that state until the tween has finished.

Every Frame will also stay in its state until its conditions are met or another action in the state sends an event.

if you want to do a tween but want to go to the next state right away, you should setup the 'Animation' Part on a separate fsm.

Then use a 'Send Event (By Name) and send a event to that fsms to trigger the animation.

Here is a video about Transitions :


meerkatinvasion

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Some actions wont 'finish'
« Reply #2 on: July 13, 2020, 02:56:15 PM »
Thanks for the reply!

What I mean is actions do not finish even after their timers expire. For example a Wait action with a 1 second timer & real time checked prevents the state machine from advancing even after it's timer (1 second) has expired. Same with DO Tween, if animation takes any amount of time to complete (again, 1 second for example) that will stop state machine from finishing even after 1 second passes.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Some actions wont 'finish'
« Reply #3 on: July 13, 2020, 06:52:44 PM »
Hi.
Do you have a transition set on the wait/dotween?

Can you show a video or some images?

meerkatinvasion

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Some actions wont 'finish'
« Reply #4 on: July 14, 2020, 03:30:40 AM »
Sure

This video shows the flow without the Animation (Tween) state, this works as inteded:
This one shows what happens when I add the Animation (Tween) state in between two states, the FSM does not advance past the Animation state.
 
In the second video Animation state only has one action which is a DOTween Transform Move; but the problem can be replicated if you change DOTween action with a Playmaker Wait action
« Last Edit: July 14, 2020, 08:05:10 AM by meerkatinvasion »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Some actions wont 'finish'
« Reply #5 on: July 14, 2020, 09:21:45 AM »
Hi.
It looks Like the mouse over is the issue there.
You probably have a Global Transition for Mouse Exit (State 3?) as well

So when the Tween Starts to move the object and the mouse won't be over it any more, it will trigger Mouse Exit.

Try setting the Mouse over and Mouse Exit as local instead of global.


meerkatinvasion

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Some actions wont 'finish'
« Reply #6 on: July 14, 2020, 10:22:24 AM »
Yes! It works, thank you! I'm changing the title to SOLVED.