This script is supposed to change the position of the gameobject it is set to in the inspector. I dont know why it wont work though. Code (CSharp): using UnityEngine; using System.Collections; public class RotateRoad : MonoBehaviour { public GameObject road; void Start () { road = GameObject; } void Update () { if(Input.GetKeyDown("space") road.transform.position = (2,2,2); } }
In Start, you try to set the variable to the class GameObject. Uh... don't do that. And check your console for error messages - they'll help us help you (and help you help yourself). That line will definitely cause a compiler error.
There is generally no value in caching a components GameObject in start. Nor is a GameObject reference required to access a Transform.