I have tried to follow all the tutorials I can find but none of the seem to work. I am trying to set up varying levels of difficulty to affect the speed of an object in another scene. Here is my static object code:
public class Diff : MonoBehaviour{
public static int diff;
void Awake()
{
diff = 2;
DontDestroyOnLoad(this);
}
}
Am I doing anything wrong? This is how im trying to change the variable:
void OnMouseUp()
{
Diff.diff = 1;
}
And this is how im trying to use it in the other scene:
public float speed;
void Update ()
{
if(Diff.diff == 1)
{
speed = 7;
}
}
Does anybody have any ideas?