コード例 #1
0
        private void CreateNewLevelList()
        {
            CurrentLevelIndex  = 1;
            LevelDatabase      = CreateLevelDatabase();
            LevelDatabase.List = new List <Level>();
            var relPath = AssetDatabase.GetAssetPath(LevelDatabase);

            EditorPrefs.SetString("ObjectPath", relPath);
        }
コード例 #2
0
        private void OnEnable()
        {
            if (!EditorPrefs.HasKey("ObjectPath"))
            {
                return;
            }
            var objectPath = EditorPrefs.GetString("ObjectPath");

            LevelDatabase = AssetDatabase.LoadAssetAtPath(objectPath, typeof(LevelDatabase)) as LevelDatabase;
        }
コード例 #3
0
        private void OpenLevelList()
        {
            var absPath = EditorUtility.OpenFilePanel("Select Level List", "", "");

            if (!absPath.StartsWith(Application.dataPath, System.StringComparison.Ordinal))
            {
                return;
            }
            var relPath = absPath.Substring(Application.dataPath.Length - "Assets".Length);

            LevelDatabase = AssetDatabase.LoadAssetAtPath(relPath, typeof(LevelDatabase)) as LevelDatabase;
            if (LevelDatabase != null && LevelDatabase.List == null)
            {
                LevelDatabase.List = new List <Level>();
            }
            if (LevelDatabase)
            {
                EditorPrefs.SetString("ObjectPath", relPath);
            }
        }