How did you make the obstacles move by themselves.
To make the obstacles move left to right you can create a script and paste the code in it below. After that you can drag the script to the obstacles you want to move left to right. You can change the amount to move left and right from the start point.
using UnityEngine;
using System.Collections;
public class leftToRight : MonoBehaviour
{
public float delta = 1.5f; // Amount to move left and right from the start point
public float speed = 2.0f;
private Vector3 startPos;
void Start()
{
startPos = transform.position;
}
void Update()
{
Vector3 v = startPos;
v.x += delta * Mathf.Sin(Time.time * speed);
transform.position = v;
}
}
---Ohh yeah and if you want the obstacle to spin around use this code:---
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpinCube : MonoBehaviour {
public float speed = 1f;
void Update () {
transform.Rotate(speed, speed, 0);
}
}
Hope this helps :)