C# to Unity script question ?

Please help :slight_smile: I need to convert this small piece of C# script into UnityJS ,im stuck for some reason :()

// at top of ControlledCar.cs, within the class add
public Joystick leftJS;
public Joystick rightJS;

// in Scenario select the Car and link the joysticks to the two new properties.
// in FixedUpdate function replace the steer=… accel=… brake=… lines with something like this:
steer = Mathf.Clamp(Input.GetAxis("Horizontal") + leftJS.position.x, -1f, 1f);
accel = Mathf.Clamp(Input.GetAxis("Vertical") + rightJS.position.y, -1f, 1f);
brake = Input.GetButton("Jump") || (rightJS.position.y < 0.95f);

Only two differences :

Variable declaration

C# : [protection level (default private)] [type] [name];

UnityScript : [protection level (default public)] var [name] : [type];

Floats

C# : 1f / 1.0f;

UnityScript : 1.0;

Done lol ,i went around it a completely different way :stuck_out_tongue:

I dropped the Unity Car Tutorial demo completely ,as noone knows how to stop the car moving when it shouldnt ,so its a pointless exercise …

ANSWERED - You have to use pragma strict for the Iphone or android my car runs perfectly now ,well it stops when its meant to lol ,.So the answer is convert all the Unity Car Tutorial to #Pragma Strict and it does actually work