Hello and Merry Christmas, after many searches here and other places I've came back to ask again for help for my project. It's an endless vertical game, and I want to despawn the objects left behind the camera. I'm using PoolManager actions but I'm in a deadlock, I can't figure out how to use the despawn action. So for the moment I have a SpawnGameObject which will spawn first 10 obstacles, then will stop and wait. Everything works fine, I'm not sure if it's ok what I've made, because it's spawning random obstacles from prefabs stored in a variable. The same prefabs are declared in the SpawnPool. But now I don't know where to put the despawn action, and how to make it work, I've tried with a simple destroy self action when triggered.
So my logic is something like that:
De Spawn action should despawn when player trigger box enter in the prefab trigger area, but the problem is I want to de spawn last obstacle which is a random one. So i can't tell De Spawn what Game Object should despawn. If I put the variable it will try to despawn a random one, and will throw an error. So I'm thinking I should make states for every obstacle and check them all and if It's one it will be despawned. I think it could be an easy way and I can't figure it out.
Ok and the second problem is with the loop spawning, after 10 obstacles spawner stops, i've tried to re-compare ints after destroying some obstacles, but it won't start to spawn again.
If somebody can help me some hints it will be great, or a scheme with the states. Sorry for this long post and lots of infos without pics. If you need to see my FSM i will post some screenshots.