playMaker

Author Topic: Input Action Button gives loop count error [SOLVED]  (Read 2149 times)

Adam Z

  • Full Member
  • ***
  • Posts: 207
Input Action Button gives loop count error [SOLVED]
« on: September 14, 2021, 03:18:16 PM »
Hi, so I'm trying to create a simple button that swiches states every time I press the "c" key. The screenshots show my setup. The error I get is:
"Main Camera : FSM : Loop count exceeded limit: 1000. Override the default limit (1000) in FSM Inspector > Settings > Max Loop Override."

I tried adding an 'Interactions > Press Only' and tried 'Press And Release', and that didnt fix it either.

Any thoughts on how to fix this? Thanks!
« Last Edit: October 04, 2021, 04:11:51 PM by Adam Z »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Input Action Button gives loop count error
« Reply #1 on: September 15, 2021, 08:30:33 AM »
Hi.
what do you have in state 2?

you can set a next frame event in between, this way it will loop only once every frame.

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Input Action Button gives loop count error
« Reply #2 on: September 15, 2021, 09:47:47 AM »
State 2 has the same action. So I'm assuming that once I press the "c" key it goes to the next state, still detects that the "c" key is being pressed, and it cycles through the FSM over and over.

I tried using 'Next Frame Event', but that loops forever as well if someone holds the "c" key down.

I was able to get it to work by adding 'Interactions > Press' and then 'Press And Release' in my Input Actions on the button. On my first state I used "Was pressed this frame" then on a buffer state I used "Was released this frame", so it works if I used 4 states.

I was hoping I could set up my FSM only using 2 states.

Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Input Action Button gives loop count error
« Reply #3 on: October 04, 2021, 03:25:10 PM »
Hi.
what do you have in state 2?

you can set a next frame event in between, this way it will loop only once every frame.
Any thoughts on this? Thanks.

10high

  • Playmaker Newbie
  • *
  • Posts: 33
    • Cult Manager - Google Play
Re: Input Action Button gives loop count error
« Reply #4 on: October 04, 2021, 03:33:46 PM »
Maybe I misunderstand, but you've desctibed the problem yourself: You press "C", it exits the state and in the next state you are aslo listening for "CC", so you get an infinite look.

Shouldn't you in State 1 listen for "get C down", exit to state 2, perform whatever action you want and listen for "get C up" and return to state 1?
Cult Manager


Adam Z

  • Full Member
  • ***
  • Posts: 207
Re: Input Action Button gives loop count error
« Reply #5 on: October 04, 2021, 03:44:02 PM »
Maybe I misunderstand, but you've desctibed the problem yourself: You press "C", it exits the state and in the next state you are aslo listening for "CC", so you get an infinite look.

Shouldn't you in State 1 listen for "get C down", exit to state 2, perform whatever action you want and listen for "get C up" and return to state 1?
So my original screenshot is the old way I was setting it up.

After adding to the Input Actions a: 'Interactions > Press' and then 'Press And Release', I set up the states like this:

State 1 is now using a "Was Pressed This Frame". State 2 is using a 'Was Released This Frame'. As of now I need to have a State in between with a 'Send Event: FINISHED'. So:

                                           State 1 (Was Pressed)

         State 2b (Next Frame)                                     State 1b (Next Frame)

                                         State 2 (Was Released)


I was hoping that I could use just two states for it to work.
« Last Edit: October 04, 2021, 03:45:36 PM by Adam Z »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7623
    • jinxtergames
Re: Input Action Button gives loop count error
« Reply #6 on: October 04, 2021, 03:44:27 PM »
Hi.
@10high

Actually if you use 'Get Key Down' it will not loop, it will stop on the next state where you have a 'Get Key Down' with the same key until you release and press again :)

@Adam Z
Yeah the action works different than get key/button down actions.

is this action from an asset?
if so maybe you can ask the author to make or adjust the action as there are many cases you would not want it to loop.

10high

  • Playmaker Newbie
  • *
  • Posts: 33
    • Cult Manager - Google Play
Re: Input Action Button gives loop count error
« Reply #7 on: October 04, 2021, 04:07:34 PM »
Quote
Actually if you use 'Get Key Down' it will not loop, it will stop on the next state where you have a 'Get Key Down' with the same key until you release and press again

Yeah, duh - sorry, brain tired. I meant held down.
Cult Manager