Getting infinite loop error and i dont know how to fix it

“Tile gen” spawns “Tile gen” which goes to “begin play” and spawns “Tile gen” which spawns “Tile gen”

Congratulations you discovered recursive code :smiley:

This idea can work, however you need to calculate how deep you spawn them and cut off at some point. Also tip: hardcode to always cut off at some point.

1 Like

I got your question in my email notification. :wink:
Also just in case anybody else cannot get how this thing does infinite loops.

  • you place “tile_gen” in level
  • every “tile_gen” at begin play spawns new “tile_gen” actor.
  • what that “tile_gen” you just spawned does? Yup it spawns new “tile_gen”, so kind of back to first step, but just on new actor. This is loop, but done in different actors, instead of single one.

And very important thing to remember:
Blueprint CODE (or actor in blueprint editor) is just code/actor for you to see. THere may be multiple actors with same code. This is why it is so hard to debug blueprints in debugger (for some people at least), you need to show debugger which one actor you want see. So remember code in editor is not actual code in level (yes they are same code, but one is just virtual, another is copy that runs).

1 Like