1 #pragma strict
2
3 var roationSpeed = 100;
4
5 function Update ()
6 {
7 var rotation : float = Input.GetAxis (“Horizontal”) * rotationspeed;
8 rotation *= Time.deltaTime;
9 GetComponent.().AddRelativeTorque (Vector3.back * rotation);
10 }
If you’re new to Unity, my 1st advice to you is:
DO NOT waste time learning UnityScript (when you called it Java, you killed a kitten). It’s a modified version of Javascript that’s losing support. C# is a language that there is a lot more documentation, online help and tutorials for. Also, C# can be used in so many other applications (such as Windows Forms, WPF, Xamarin), so it’s a handy language to know. UnityScript is (was) only used in Unity, and shares little in common with Javascript.
2nd, use the “Insert Code” button so it’s easy to read code: Using code tags properly - Unity Engine - Unity Discussions
3rd, this question should be in the Scripting section of the forum. Questions in the right place have a higher chance of getting answers.
Now, your problem is that “rotationSpeed” is spelled wrong in line 3, and keep the capitalization the same.
Also, check out the tutorials at unity3d.com/learn/tutorials
Good luck! ![]()