Hi,
I’m trying to read a value from one script and use that to determine which level to load.
I’m using the SwipeControl script by Blackish (colOOOr) which displays the levels and you can swipe them to change the picture. This has a currentValue int which is used to tell it which picture is displaying.
I than have a play button which I wanted to read the currentValue and select the level to load.
I set the currentValue in the SwipeControl scrip to a static var and then use the following code on the button.
var isPlayButton = false;
function OnMouseDown () {
if (isPlayButton)
{
if (SwipeControl.currentValue)
{
SwipeControl.currentValue = 5;
// Load Level code//
}
else if (SwipeControl.currentValue)
{
SwipeControl.currentValue = 4;
// Load Level code//
}
}
}
However, it’s not taking the value and so keeps trying to load the first level instead.
I’m hoping some fresh eye’s (or cleverer brains) can spot what I am doing wrong.