errors in OnGui function

hello, i´m trying to display a win message when the player collides with a flag.
I get some errors, please help me to solve them!
Here’s the code:

#pragma strict
function Start () {
var Win : boolean = false;
}

function Update () {
if (CheckCollision.Win){
Win = true;
}
}
function OnGui(){
if (Win == true){
GUI.Box(Rect(Screen.width / 2 - Screen.width / 4 ,0,Screen.width / 4, Screen.height / 3), "YOU WON !!!");
}
}

Here are the errors:
-(7,20): BCE0020: An instance of type ‘CheckCollision’ is required to access non static member ‘Win’.

  • (8,1): BCE0005: Unknown identifier: ‘Win’.
    -(12,5): BCE0005: Unknown identifier: ‘Win’.
    thanks!

‘width’ is spelled ‘width’

#pragma strict

var Win : boolean = false;

function Update ()
{
    if (CheckCollision.Win)
    {
        Win = true;
    }
}

function OnGui()
{
    if (Win)
    {
        var w = Screen.width / 4;
        var h = Screen.height / 3;
        GUI.Box(Rect(w, 0, w, h), "YOU WON !!!");
    }
}

In your CheckCollision script you have to declare your Win variable as static to access it like you did here. Otherwise you have to get a reference to the script somehow. However this depends on where the CheckCollision script is attached to and where this script is attached to.

//CheckCollision.js
#pragma strict

static var Win : boolean = false;
// [...]