- Home /
error cs0120
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! 
You may want to watch the video to learn how to format your code correctly.
Answer by Chronos-L · Apr 21, 2013 at 09:24 AM
Mistake
 Transform.Rotate( 0.0f, -80.0f * Time.deltaTime ) ;
Correction
 transform.Rotate( 0.0f, -80.0f * Time.deltaTime ) ; 
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Error line 22! Help. i dont know why? 1 Answer
Multiplayer Script error 2 Answers
3 errors in scrip. 1 Answer
what is wrong with this online FPS script(not done) ? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                