static void Record() { ObjectsRecorder.Add(Selection.instanceIDs); string save = ""; foreach (var item in ObjectsRecorder) { foreach (var obj in item) { save += obj.ToString() + ","; } save += "-"; } EditorPrefs.SetString("PreviousNextSelection", save); }
static void SelectionChangeEvent() { if (disableRecordSelected) { disableRecordSelected = false; } else { if (current != ObjectsRecorder.Count - 1) { ObjectsRecorder.RemoveRange(current + 1, ObjectsRecorder.Count - (current + 1)); } Record(); if (ObjectsRecorder.Count > 21) { ObjectsRecorder.RemoveAt(0); } current = ObjectsRecorder.Count - 1; } if (ShowWindow) { window.Repaint(); } }
void OnGUI() { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(!enablePreviouse); if (GUILayout.Button("<")) { PreviouseSelected(); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(!enableNext); if (GUILayout.Button(">")) { NextSelected(); } EditorGUI.EndDisabledGroup(); EditorGUILayout.EndHorizontal(); if (ObjectsRecorder != null) { // scrollerPos = EditorGUILayout.BeginScrollView(scrollerPos); for (int i = 0; i < ObjectsRecorder.Count; i++) { var ele = ObjectsRecorder[i]; string countInfo = ""; if (ele.Length > 1) { countInfo = " Count : " + ele.Length.ToString(); } else if (ele.Length != 0) { countInfo = " \tInstanceID : " + ele[0].ToString(); } GUIStyle s = new GUIStyle("label"); if (current == i) { s.richText = true; s.normal.textColor = Color.yellow; GUILayout.Label("<b>" + ("Element." + i.ToString() + countInfo) + "</b>", s); } else { if (GUILayout.Button("Element." + i.ToString() + countInfo, s)) { current = i; changeSelectionObjectsFromList(); } } // if(ele.Length > 1){ // EditorGUI.indentLevel = 2; // foreach (var item in ele) { // EditorGUILayout.LabelField(item.ToString()); // } // } } // EditorGUILayout.EndScrollView(); } Rect clearPos = new Rect(0, window.position.height - 20, window.position.width, 20); if (GUI.Button(clearPos, "Clear")) { current = 0; ObjectsRecorder.Clear(); Record(); } }