I am making a script to where when a block hits a trigger, it changes directions. what is wrong with mine?
C#
using UnityEngine;
using System.Collections;
public class Move : MonoBehaviour {
public float speed = 3.0f;
// Use this for initialization
void Update () {
transform.position += Vector3.left * speed;
}
void OnTriggerEnter(Collider other){
if(gameObject.tag == ("Left")){
transform.position += Vector3.left * speed;
}
if(gameObject.tag == ("Right")){
transform.position += Vector3.right * speed;
}
}
}