Hi, I got this problem, which I think, is caused by the order scripts are run. The spline and the controllers are set to fixed update. (I'm using Playmaker too)
I have a FSM loop that once you press play will spawn from a pool and attach prefabs to a spline. It spawns a prefab and sends variables to its controller all in one frame. On the spawned prefab I have a FSM that runs when the object is spawned, that assign the sent variables to the spline controller. This also happens in the same frame.
Once the spline is full, the spawn FSM moves on to spawn new prefabs as the others move along the spline. Once the last spawned prefab has reached a point, the next one is spawned and setup in the same frame.
This works for a few spawns then it breaks. The new spawns can end up anywhere on the spline, then it works, then it breaks again. I thought it used the saved position from the prefab, but setting it to 0 didn't help. Which is odd since it attached to the spline and set speed etc. to the correct values.
I tried to add a wait so it didn't didn't read the position of the last spawn until a few frames later, in case it spawned too fast. Didn't work.
After looking for a while -I think- the once that broke are once that are spawned from the pool, despawned and then spawned again. And I think this causes a change in the order "some" stuff are run on the prefab.
I then I tried to add a one frame delay on the newly spawned prefab, so it setup itself one frame after it spawned. That kinda fixed it. The spawns that broke now works but the once that didn't brake now spawn with a one frame delay. So now everything is desynced.
This is no good. It's very important that I have frame perfect timings for these things. And what if it decides to break during the initial spawn? Maybe it will vary on different computers. It's crucial that I can assure the same things happens on the same frame every time, all the time.
This became a bit long, but the question is, do you have a suggestion how I can make sure the controller does its thing only "after" the spawn FSM has finished, without having to resort to frame delays? Like I said, I require frame perfect precision for this.
Thanks.
I have a FSM loop that once you press play will spawn from a pool and attach prefabs to a spline. It spawns a prefab and sends variables to its controller all in one frame. On the spawned prefab I have a FSM that runs when the object is spawned, that assign the sent variables to the spline controller. This also happens in the same frame.
Once the spline is full, the spawn FSM moves on to spawn new prefabs as the others move along the spline. Once the last spawned prefab has reached a point, the next one is spawned and setup in the same frame.
This works for a few spawns then it breaks. The new spawns can end up anywhere on the spline, then it works, then it breaks again. I thought it used the saved position from the prefab, but setting it to 0 didn't help. Which is odd since it attached to the spline and set speed etc. to the correct values.
I tried to add a wait so it didn't didn't read the position of the last spawn until a few frames later, in case it spawned too fast. Didn't work.
After looking for a while -I think- the once that broke are once that are spawned from the pool, despawned and then spawned again. And I think this causes a change in the order "some" stuff are run on the prefab.
I then I tried to add a one frame delay on the newly spawned prefab, so it setup itself one frame after it spawned. That kinda fixed it. The spawns that broke now works but the once that didn't brake now spawn with a one frame delay. So now everything is desynced.
This is no good. It's very important that I have frame perfect timings for these things. And what if it decides to break during the initial spawn? Maybe it will vary on different computers. It's crucial that I can assure the same things happens on the same frame every time, all the time.
This became a bit long, but the question is, do you have a suggestion how I can make sure the controller does its thing only "after" the spawn FSM has finished, without having to resort to frame delays? Like I said, I require frame perfect precision for this.
Thanks.