The UnityEngine
namespace doesn't contain any class named Joystick
.
You can, however, access joystick input that has been set up in the Input Manager by querying Input.GetAxis()
.
Suppose you set up a joystick to control two axes, named "Joy0x" and "Joy0y", you could then get the input like so:
function Update() {
var x = Input.GetAxis("Joy0x");
var y = Input.GetAxis("Joy0y");
transform.Rotate(x, y, 0); //rotate attached GameObject
}
I imagine many people have posted joystick helper scripts. If you're working with one of those, please mention it.