Example #1
0
    /// <summary>
    /// Get the current level index from the player prefs.
    /// Destory this gameobject if GetLevelAtIndex returns null.
    /// </summary>
    private void SetCurrentLevel()
    {
        int levelIndex = PlayerPrefs.GetInt("Level");

        currentLevel = levelList.GetLevelAtIndex(levelIndex);

        if (!currentLevel)
        {
            Destroy(this.gameObject);
        }
    }