Im having trouble with my scripting. I use c#.
Here are the following errors:
Assets/CArrrrr.cs(20,25): error CS0120: An object reference is required to access non-static member `UnityEngine.Transform.Rotate(UnityEngine.Vector3)’
and
Assets/CArrrrr.cs(22,22): error CS0120: An object reference is required to access non-static member `UnityEngine.Transform.Rotate(UnityEngine.Vector3)’
using UnityEngine;
using System.Collections;
public class CArrrrr : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if(Input.GetKey( KeyCode.W) ) {
transform.position += transform.forward * 5.0f * Time.deltaTime; }
if(Input.GetKey( KeyCode.S) ) {
transform.position -= transform.forward * 2.0f * Time.deltaTime; }
if(Input.GetKey( KeyCode.A) ) {
Transform.Rotate( 0.0f, -80.0f * Time.deltaTime ) ; }
if(Input.GetKey( KeyCode.D) ) {
Transform.Rotate( 0.0f, 80.0f * Time.deltaTime ) ;
}
}
}
Someone plz help!
Mistake
Transform.Rotate( 0.0f, -80.0f * Time.deltaTime ) ;
Correction
transform.Rotate( 0.0f, -80.0f * Time.deltaTime ) ;