void GetObjects() { string[] guids = AssetDatabase.FindAssets("t:prefab"); string path = ""; GameObject go = null; prefabs = new Keylist <string, GameObject>(); for (int i = 0; i < guids.Length; i++) { // Get the path of the current guid path = AssetDatabase.GUIDToAssetPath(guids[i]); // Load gameObject go = AssetDatabase.LoadAssetAtPath <GameObject>(path); // Continue if (null == go) { continue; } // Add to the key list prefabs.Add(path.Substring(0, path.LastIndexOf("/")), go); } isExpanded = new List <bool>(); for (int k = 0; k < prefabs.KeyCount; k++) { isExpanded.Add(true); } }
Keylist <Type, Object> GetEditorKeylist(SerializedProperty[] components) { // We are going to organize components by type using a Keylist Keylist <Type, Object> keylist = new Keylist <Type, Object>(); // Current type Type type = null; // Current object reference value Object value = null; for (int i = 0; i < components.Length; i++) { // Get object value value = components[i].objectReferenceValue; // Get type type = value.GetType(); // Add to key list keylist.Add(type, value); } return(keylist); }