Crash on LoadLevel (Android Project)

Hi.

My game crashes as soon as i hit a button which sends me on to next scene, does anyone know what the problem could be? I’ve updated to the late version of unity3d and nothing changed.

public void SetLevel(int i)
    {
        Application.LoadLevel(1);
        SetLevel(i);
    }


public void SetLevel(int index)
    {
        switch(index)
        {
            case 1:
                ...
            break;

            case 2:
                ...
            break;
        }

        ...

        //Set the num of checkpoints to game control.
        gc.checkpointsLeft = checkpointsLeft;
    }

You are calling SetLevel recursively - look at line 4 of your code above. Two functions can have the same name, but they can’t have the same number and types of arguments in the same order. That will surely confuse the compiler. If the code is actually written as you have it in your example, I’m kind of surprised it would even compile at all.

I’d change the name of one of those functions to something unique. That would remove the ambiguity that is probably causing your problem. Also, it seems you are loading level 1 no matter what value you pass to SetLevel.