PlayMaker Help & Tips > PlayMaker Help

[solved] Will I get an infinite loop error for this?

(1/1)

createasaurus:
I have StateA and StateB.  Each state contains, some commands and a Wait for .25 seconds then Finish.  StateA Finish leads to StateB.  StateB Finish leads to StateA.  It goes back and forth.  It runs great.  However, will this give me a problem later???  For instance if the game runs for 20 minutes or so and the back and forth reach a critical number, like 1000.  Will it then trigger infinite loop error?  Or am I safe?
Thank you for your thoughts!

Lane:
Infinite loops errors are triggered when they are uncontrolled like 1000x per second. In this case it's not happening fast enough to cause an issue.

Alex Chouls:
No, you're fine. You get infinite loop errors when you loop through the same states too many times in *one frame* It's trying to catch a loop that would otherwise hang or crash Unity. Instead of crashing, Playmaker breaks out of the loop and throws an error so you can investigate the cause... If you made the same infinite loop in a script it would crash Unity!

Your scenario is fine :)

There's an option in the Debug menu: Show State Loop Counts that can be useful when working with loops. It shows the number of times a state was entered this frame.

createasaurus:
Excellent!  Thank you so much.  I will proceed as planned :D

Navigation

[0] Message Index

Go to full version