Simple compass


#1

Here’s a simple compass for Zombie Runner:

There’s a canvas, with a panel. On the panel, there’s a text object for the N, and a raw image with the arrow.

The code in Player.cs:

private RawImage compassNeedle;

void Start () {
    ...
    compassNeedle = GameObject.Find ("CompassNeedle").GetComponent<RawImage>();
}

void Update () {
    //Set the compass needle position.
    compassNeedle.transform.rotation = Quaternion.Euler(0, 0, -transform.rotation.eulerAngles.y);
}

#2

Thanks for sharing, so simple