I need a projectile obstacle

I need script that makes a projectile (or game object) appear from a certain spot (or from a game object), move in a direction and disappear, all in loop. This is for a 2D endless runner and I only need something simple.

There’s really not much to work with here so I’m throwing you some ideas. Instantiate the Object and use transform.Translate to move it in a direction. In order to remove it you could just call Destroy(gameObject, 2f); on Start which will remove it after 2 seconds. Or you check it’s horizontal coordinate against the cameras (in case the camera moves too) and then Destroy it.
If you dont want to destroy it (because you mentioned a loop) just set it’s position back to the spawn position (which you stored in a member on start)