Example #1
0
    // Use this for initialization
    void Start()
    {
        MapGeneratorScript script = GetComponent <MapGeneratorScript>();

        while (!generated && attempts < MAX_ATTEMPTS)
        {
            try
            {
                attempts++;
                script.GenerateMap();
                generated = true;
                Debug.Log("successfully created map in " + attempts + " attempts");
            }
            catch (Exception e)
            {
                Debug.Log("failed attempt number " + attempts);
                script.CleanUp();
                Debug.Log(e);
            }
        }
    }