public static bool ShrunkListIfNeeded()
        {
            bool hasChanged = false;

            if (SelectedObjectsCount >= UnityEssentialsPreferences.GetMaxSelectedObjectStored())
            {
                hasChanged = true;
                SelectedObjectsList.RemoveAt(0);
            }
            while (SelectedObjectsWithoutDuplicateCount >= UnityEssentialsPreferences.GetMaxObjectSHown())
            {
                hasChanged = true;
                SelectedObjectsWithoutDuplicateList.RemoveAt(0);
            }
            while (PinnedObjectsCount >= UnityEssentialsPreferences.GetMaxPinnedObject())
            {
                hasChanged = true;
                PinnedObjectsList.RemoveAt(0);
            }
            while (PinnedObjectsInScenesCount >= UnityEssentialsPreferences.GetMaxPinnedObject())
            {
                hasChanged = true;
                PinnedObjectsInScenesList.RemoveAt(0);
                PinnedObjectsNameInScenesList.RemoveAt(0);
                PinnedObjectsScenesLinkList.RemoveAt(0);
            }
            return(hasChanged);
        }
        public static void MoveToBookMark(int index)
        {
            SelectedObjectsWithoutDuplicateList.AddObject(PinnedObjectsInScenesIndex(index));

            PinnedObjectsScenesLinkList.RemoveAt(index);
            PinnedObjectsInScenesList.RemoveAt(index);
            PinnedObjectsNameInScenesList.RemoveAt(index);

            Save(30);
        }
        public static void ClearBookMarkGameObjects()
        {
            if (PinnedObjectsInScenesList.ContainsObject(LastSelectedObject))
            {
                PeekSerializeObject.ChangeLastSelectedObject(null);
            }

            PinnedObjectsInScenesList.ClearArray();
            PinnedObjectsNameInScenesList.ClearArray();
            PinnedObjectsScenesLinkList.ClearArray();
            Save();
        }
 /// <summary>
 /// trigger when scene is deleted, or on peekLogic init / update
 /// </summary>
 public static void DeleteBookMarkedGameObjectOfLostScene()
 {
     for (int i = PinnedObjectsScenesLinkCount - 1; i >= 0; i--)
     {
         if (PinnedObjectsScenesLinkIndex(i) == null && PinnedObjectsInScenesIndex(i) == null)
         {
             PinnedObjectsScenesLinkList.RemoveAt(i);
             PinnedObjectsInScenesList.RemoveAt(i);
             PinnedObjectsNameInScenesList.RemoveAt(i);
         }
     }
     Save();
 }
        public static void Reset()
        {
            ChangeLastSelectedObject(null);
            SetCurrentIndex(-1);

            SelectedObjectsList.ClearArray();
            SelectedObjectsWithoutDuplicateList.ClearArray();
            PinnedObjectsList.ClearArray();
            PinnedObjectsInScenesList.ClearArray();
            PinnedObjectsNameInScenesList.ClearArray();
            PinnedObjectsScenesLinkList.ClearArray();

            Save();
        }
        public static void RemoveBookMarkedGameObjectItem(int index)
        {
            if (LastSelectedObject == PinnedObjectsInScenesIndex(index))
            {
                PeekSerializeObject.ChangeLastSelectedObject(null);
            }
            SelectedObjectsList.RemoveAllObject(PinnedObjectsInScenesIndex(index));
            SelectedObjectsWithoutDuplicateList.RemoveObject(PinnedObjectsInScenesIndex(index));

            PinnedObjectsInScenesList.RemoveAt(index);
            PinnedObjectsNameInScenesList.RemoveAt(index);
            PinnedObjectsScenesLinkList.RemoveAt(index);

            Save();
        }
 public static void KeepLinkAndNamesUpToDate()
 {
     if (PinnedObjectsInScenesList == null || PinnedObjectsNameInScenesList == null || PinnedObjectsScenesLinkList == null)
     {
         return;
     }
     for (int i = 0; i < PinnedObjectsInScenesCount; i++)
     {
         if (PinnedObjectsInScenesIndex(i) == null)
         {
             continue;
         }
         PinnedObjectsNameInScenesList.GetArrayElementAtIndex(i).stringValue = PinnedObjectsInScenesIndex(i).name;
     }
     Save(30);
 }
        public static void AddNewBookMark(UnityEngine.Object toSelect)
        {
            GameObject toSelectGameObject = toSelect as GameObject;

            if (toSelectGameObject != null && toSelectGameObject.scene.IsValid())
            {
                if (PinnedObjectsInScenesList.AddObjectIfNoContain(toSelect))
                {
                    PinnedObjectsNameInScenesList.AddString(toSelectGameObject.name);
                    PinnedObjectsScenesLinkList.AddObject(AssetDatabase.LoadAssetAtPath <SceneAsset>(toSelectGameObject.scene.path));
                }
            }
            else
            {
                PinnedObjectsList.AddObjectIfNoContain(toSelect);
            }
        }
 public static string PinnedObjectsNameInScenesIndex(int index)
 {
     return(PinnedObjectsNameInScenesList.GetArrayElementAtIndex(index).stringValue);
 }