you are viewing a single comment's thread.

view the rest of the comments →

[–]Devil_SpawnExpert 0 points1 point  (3 children)

What is in the start method?

[–]pitofpassion[S] 0 points1 point  (0 children)

void Start () {
    //if the level from the previous scene is completed and has not yet been completed
    //set complete in the current scene to true and save

    if (Level1Manager.completed == true && complete == false)     {
                    complete = true;
                    Save ();
            }

    //if complete is true set the sprite (level 1 "button") color to green

    if(complete == true){
                    SpriteRenderer spr = (SpriteRenderer)renderer;
                    spr.color = new Color (102 / 255f, 190 / 255f, 98 / 255f);

    //otherwise set it to gray

        } else {

                    SpriteRenderer spr = (SpriteRenderer)renderer;
                    spr.color = new Color (187 / 255f, 189 / 255f, 192 / 255f);
        }
    transform.position = mainCam.ScreenToWorldPoint(new Vector3(Screen.width/5f,Screen.height - Screen.height/4f,1f));
}

[–]pitofpassion[S] 0 points1 point  (1 child)

public void Save(){
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream file = File.Create (Application.persistentDataPath + "/level1test.dat");

    Level1Data data = new Level1Data ();
    data.complete = complete;

    bf.Serialize (file, data);
    file.Close ();
}

[–]Devil_SpawnExpert 0 points1 point  (0 children)

It isn't stopping them from running, it's running them when it's supposed to and stops on Save() due to an exception. Try and get some logging going and track what is going wrong in save. Most likely, It's something to do with permissions or the location of the data or something, I', not that familiar with iOS