playMaker

Author Topic: [SOLVED] Create Object action is creating objects on every frame  (Read 1653 times)

Umbrella

  • Playmaker Newbie
  • *
  • Posts: 4
Hi everyone,

I'm a beginner and I'm still learning the basics. I've seen some tutorials on how to duplicate objects across a certain axis using a loop (Create object + Int Add + Int compare) I've followed the tutorials step by step and it all seems to be working except on my end the FSM is spawning infinite number of objects!

I thought at first it was ignoring the object counter variable and the int compare action but after 4 hours of trying to solve this problem I noticed that the counter and int compare actions are working fine and the logic is kinda working. I can see the counter number going up +1 on each loop until it reaches 5 which is the total number I set for spawning objects.. but the Create Object action is firing with each state even if it's not its turn yet. It's like it's creating an object on every frame. It's also spawning objects even when the FSM reaches the final state. It just keeps creating objects forever until Unity freezes. Also in other cases the whole FSM is reseting every time it's complete. It's even firing the setup state again which shouldn't be the case. I've tried replacing Create Object action with other actions and it was working normally. The Setup state only fired once as it should. But every time I activate Create Object action the same issues occur.

I also tried following this tutorial:
https://www.youtube.com/watch?time_continue=336&v=4A0W3HECnUI&feature=emb_title

I followed it exactly as it is step by step and I still had the same problem. I tried doing it my way by literally separating each action on a separate state. I also put a Wait action in between each state just to make sure that everything is firing in the correct order.. I've noticed a new object gets created even at the beginning of a Wait state. I'm confused.. Am I missing something? Is there a way to stop creating objects on every frame? I've spent hours just trying to figure it out on my own.
I'm sorry if it's something basic that I should've known but I've searched this forum and I couldn't find anyone with a similar problem..
« Last Edit: July 15, 2020, 12:50:02 PM by Umbrella »

Umbrella

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Create Object action is creating objects on every frame
« Reply #1 on: July 15, 2020, 12:46:37 PM »
Good news. I just figured it out. It was a beginner's mistake.  ;D
I set my active object as the (Game Object) in the Create object action instead of another copy (or a prefab) with no active FSM in it. My FSM was working perfectly. The FSMs that were firing each frame are the FSMs of the clones! I'm so happy that I finally figured it out!