Esempio n. 1
0
        protected override void Save()
        {
            var saveData = new List <SaveData>();

            foreach (var item in pinning)
            {
                if (item == null || item.target == null)
                {
                    continue;
                }

                var guid = UnityEditorUtility.GetAssetGUID(item.target);

                var data = new SaveData()
                {
                    guid    = guid,
                    comment = item.comment,
                };

                saveData.Add(data);
            }

            if (saveData.Any())
            {
                ProjectPrefs.Set(PinnedPrefsKey, saveData);
            }
            else
            {
                if (ProjectPrefs.HasKey(PinnedPrefsKey))
                {
                    ProjectPrefs.DeleteKey(PinnedPrefsKey);
                }
            }
        }
Esempio n. 2
0
        protected override void Save()
        {
            var prefsKey = GetPinnedPrefsKey();

            var saveData = new List <SaveData>();

            foreach (var item in pinning)
            {
                if (item == null || item.target == null)
                {
                    continue;
                }

                var localIdentifierInFile = UnityEditorUtility.GetLocalIdentifierInFile(item.target);

                if (localIdentifierInFile == -1)
                {
                    continue;
                }

                var data = new SaveData()
                {
                    localIdentifierInFile = localIdentifierInFile,
                    comment = item.comment,
                };

                saveData.Add(data);
            }

            if (saveData.Any())
            {
                ProjectPrefs.Set(prefsKey, saveData);
            }
            else
            {
                if (ProjectPrefs.HasKey(prefsKey))
                {
                    ProjectPrefs.DeleteKey(prefsKey);
                }
            }
        }