Repeating Obstacles in Unity2D.

I’ve been trying to repeat the obstacles when moving to the right or left, but getting into a lot of issues.
I basically made two triggers, one on the right side of the camera and other one on the left(as a child of camera). Whenever they collide with an obstacle, the script clone those obstacles when the trigger enter them and move them forward towards the left or right depending on the trigger that have been pushed and destroy the current one when the trigger leaves them , but when one of the trigger collides with the obstacle that just have been cloned, it starts to clone it on the other side where there is already the other trigger and this cause them to create multiple infinite obstacles on the same locations.
I tried to move the triggers apart so they won’t collide with obstacles that are being cloned and it does work that way but the only issue i have with it, that the clones pop up right in the camera view while the player is moving.
I need the obstacles to be cloned before they enter the camera view instead of popping up in the camera view.

I don’t know if this is going to make much sense to you guys, but i tried my best to explain my situation.
I will really appreciate it, if someone will be able to help me with this.

When the trigger is hit does it check what is hitting it? If not you could put one in so it only clones when hit by the player.

Well the trigger checks for a tag “obstacle”, before it clone obstacle.

But what you mean by this^.

use the code tags & post your code so we can have a look at what you are doing. We can step through it then

Well I decided to take bunch of screenshots to try to explain my situation with the help of them





Not sure if this is good enough to explain it all but that’s all i got.

It’s kind of a logical problem more than a code problem, but i can do that too if you still need me to after looking at these screenshots.

Sounds like you just need to change the coordinates of where the new ones spawn so that they are being moved further out to the side/s.
The infinite spawn probably has to do with the script doing the spawning when the objects leave the collider/trigger & you create/move them to the other side so they are in the middle of the other trigger.
Put a bool in & only spawn a clone if the bool is true. Set it as false when it is created & & set it to true when it leaves the first collider.