private void ShowFieldInfo(System.Type type, MonoImporter importer, List <string> names, List <UnityEngine.Object> objects, ref bool didModify) { if (!MonoScriptImporterInspector.IsTypeCompatible(type)) { return; } this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); foreach (System.Reflection.FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { if (!field.IsPublic) { object[] customAttributes = field.GetCustomAttributes(typeof(SerializeField), true); if (customAttributes == null || customAttributes.Length == 0) { continue; } } if (field.FieldType.IsSubclassOf(typeof(UnityEngine.Object)) || field.FieldType == typeof(UnityEngine.Object)) { UnityEngine.Object defaultReference = importer.GetDefaultReference(field.Name); UnityEngine.Object @object = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(field.Name), defaultReference, field.FieldType, false, new GUILayoutOption[0]); names.Add(field.Name); objects.Add(@object); if (defaultReference != @object) { didModify = true; } } } }
private void ShowFieldInfo(System.Type type, MonoImporter importer, List<string> names, List<UnityEngine.Object> objects, ref bool didModify) { if (IsTypeCompatible(type)) { this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); foreach (System.Reflection.FieldInfo info in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { if (!info.IsPublic) { object[] customAttributes = info.GetCustomAttributes(typeof(SerializeField), true); if ((customAttributes == null) || (customAttributes.Length == 0)) { continue; } } if (info.FieldType.IsSubclassOf(typeof(UnityEngine.Object)) || (info.FieldType == typeof(UnityEngine.Object))) { UnityEngine.Object defaultReference = importer.GetDefaultReference(info.Name); UnityEngine.Object item = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(info.Name), defaultReference, info.FieldType, false, new GUILayoutOption[0]); names.Add(info.Name); objects.Add(item); if (defaultReference != item) { didModify = true; } } } } }
private void Apply() { List <int> list = new List <int>(); List <MonoScript> list2 = new List <MonoScript>(); for (int i = 0; i < this.m_AllScripts.Length; i++) { if (MonoImporter.GetExecutionOrder(this.m_AllScripts[i]) != this.m_AllOrders[i]) { list.Add(i); list2.Add(this.m_AllScripts[i]); } } bool success = true; if (Provider.enabled) { Task task = Provider.Checkout(list2.ToArray(), CheckoutMode.Meta); task.Wait(); success = task.success; } if (success) { foreach (int num2 in list) { MonoImporter.SetExecutionOrder(this.m_AllScripts[num2], this.m_AllOrders[num2]); } this.PopulateScriptArray(); } else { Debug.LogError("Could not checkout scrips in version control for changing script execution order"); } }
private void PopulateScriptArray() { this.m_AllScripts = MonoImporter.GetAllRuntimeMonoScripts(); this.m_AllOrders = new int[this.m_AllScripts.Length]; this.m_CustomTimeScripts = new List <MonoScript>(); this.m_DefaultTimeScripts = new List <MonoScript>(); for (int i = 0; i < this.m_AllScripts.Length; i++) { MonoScript script = this.m_AllScripts[i]; this.m_AllOrders[i] = MonoImporter.GetExecutionOrder(script); if (IsValidScript(script)) { if (this.GetExecutionOrder(script) == 0) { this.m_DefaultTimeScripts.Add(script); } else { this.m_CustomTimeScripts.Add(script); } } } this.m_CustomTimeScripts.Add(sDummyScript); this.m_CustomTimeScripts.Add(sDummyScript); this.m_CustomTimeScripts.Sort(new SortMonoScriptExecutionOrder(this)); this.m_DefaultTimeScripts.Sort(new SortMonoScriptNameOrder()); this.m_Edited = null; this.m_DirtyOrders = false; }
private void ShowFieldInfo(Type type, MonoImporter importer, List <string> names, List <Object> objects, ref bool didModify) { if (IsTypeCompatible(type)) { this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); foreach (FieldInfo info in type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)) { if (!info.IsPublic) { object[] customAttributes = info.GetCustomAttributes(typeof(SerializeField), true); if ((customAttributes == null) || (customAttributes.Length == 0)) { continue; } } if (info.FieldType.IsSubclassOf(typeof(Object)) || (info.FieldType == typeof(Object))) { Object defaultReference = importer.GetDefaultReference(info.Name); Object item = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(info.Name), defaultReference, info.FieldType, false, new GUILayoutOption[0]); names.Add(info.Name); objects.Add(item); if (defaultReference != item) { didModify = true; } } } } }
private static void ResetDefaultReferences(MenuCommand command) { MonoImporter context = command.context as MonoImporter; context.SetDefaultReferences(new string[0], new Object[0]); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(context)); }
void ShowFieldInfo(Type type, MonoImporter importer, List<string> names, List<Object> objects, ref bool didModify) { // Only show default properties for types that support it (so far only MonoBehaviour derived types) if (!IsTypeCompatible(type)) return; ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); FieldInfo[] infos = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly); foreach (FieldInfo field in infos) { if (!field.IsPublic) { object[] attr = field.GetCustomAttributes(typeof(SerializeField), true); if (attr == null || attr.Length == 0) continue; } if (field.FieldType.IsSubclassOf(typeof(Object)) || field.FieldType == typeof(Object)) { Object oldTarget = importer.GetDefaultReference(field.Name, out var instanceID); if(oldTarget == null && instanceID != 0) { oldTarget = Object.CreateMissingReferenceObject(instanceID); } Object newTarget = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(field.Name), oldTarget, field.FieldType, false); names.Add(field.Name); objects.Add(newTarget); if (oldTarget != newTarget) didModify = true; } } }
public override void OnInspectorGUI() { MonoImporter target = this.target as MonoImporter; MonoScript script = target.GetScript(); if (!(bool)((UnityEngine.Object)script)) { return; } System.Type type = script.GetClass(); if (!MonoScriptImporterInspector.IsTypeCompatible(type)) { EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info); } Vector2 iconSize = EditorGUIUtility.GetIconSize(); EditorGUIUtility.SetIconSize(new Vector2(16f, 16f)); List <string> names = new List <string>(); List <UnityEngine.Object> objects = new List <UnityEngine.Object>(); bool didModify = false; this.ShowFieldInfo(type, target, names, objects, ref didModify); EditorGUIUtility.SetIconSize(iconSize); if (!didModify) { return; } target.SetDefaultReferences(names.ToArray(), objects.ToArray()); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath((UnityEngine.Object)target)); }
public override void OnInspectorGUI() { MonoImporter monoImporter = this.target as MonoImporter; MonoScript script = monoImporter.GetScript(); if (script) { Type @class = script.GetClass(); if (!MonoScriptImporterInspector.IsTypeCompatible(@class)) { EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info); } Vector2 iconSize = EditorGUIUtility.GetIconSize(); EditorGUIUtility.SetIconSize(new Vector2(16f, 16f)); List <string> list = new List <string>(); List <UnityEngine.Object> list2 = new List <UnityEngine.Object>(); bool flag = false; this.ShowFieldInfo(@class, monoImporter, list, list2, ref flag); EditorGUIUtility.SetIconSize(iconSize); if (flag) { monoImporter.SetDefaultReferences(list.ToArray(), list2.ToArray()); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter)); } } }
private void Apply() { List <int> list = new List <int>(); List <MonoScript> list2 = new List <MonoScript>(); for (int i = 0; i < this.m_AllScripts.Length; i++) { if (MonoImporter.GetExecutionOrder(this.m_AllScripts[i]) != this.m_AllOrders[i]) { list.Add(i); list2.Add(this.m_AllScripts[i]); } } bool flag = true; if (Provider.enabled) { Task task = Provider.Checkout(list2.ToArray(), CheckoutMode.Both); task.SetCompletionAction(CompletionAction.UpdatePendingWindow); task.Wait(); flag = task.success; } if (flag) { foreach (int current in list) { MonoImporter.SetExecutionOrder(this.m_AllScripts[current], this.m_AllOrders[current]); } this.PopulateScriptArray(); } else { Debug.LogError("Could not checkout scrips in version control for changing script execution order"); } }
private static void ResetDefaultReferences(MenuCommand command) { MonoImporter monoImporter = command.context as MonoImporter; monoImporter.SetDefaultReferences(new string[0], new UnityEngine.Object[0]); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter)); }
public override void OnInspectorGUI() { MonoImporter monoImporter = base.target as MonoImporter; MonoScript script = monoImporter.GetScript(); if (script) { Type @class = script.GetClass(); if (!InternalEditorUtility.IsInEditorFolder(monoImporter.assetPath)) { if (!MonoScriptImporterInspector.IsTypeCompatible(@class)) { EditorGUILayout.HelpBox("No MonoBehaviour scripts in the file, or their names do not match the file name.", MessageType.Info); } } List <string> list = new List <string>(); List <UnityEngine.Object> list2 = new List <UnityEngine.Object>(); bool flag = false; using (new EditorGUIUtility.IconSizeScope(new Vector2(16f, 16f))) { this.ShowFieldInfo(@class, monoImporter, list, list2, ref flag); } if (list2.Count != 0) { EditorGUILayout.HelpBox("Default references will only be applied in edit mode.", MessageType.Info); } if (flag) { monoImporter.SetDefaultReferences(list.ToArray(), list2.ToArray()); AssetDatabase.ImportAsset(AssetDatabase.GetAssetPath(monoImporter)); } } }
private void PopulateScriptArray() { this.m_AllScripts = MonoImporter.GetAllRuntimeMonoScripts(); this.m_AllOrders = new int[this.m_AllScripts.Length]; this.m_CustomTimeScripts = new List <MonoScript>(); this.m_DefaultTimeScripts = new List <MonoScript>(); for (int index = 0; index < this.m_AllScripts.Length; ++index) { MonoScript allScript = this.m_AllScripts[index]; this.m_AllOrders[index] = MonoImporter.GetExecutionOrder(allScript); if (ScriptExecutionOrderInspector.IsValidScript(allScript)) { if (this.GetExecutionOrder(allScript) == 0) { this.m_DefaultTimeScripts.Add(allScript); } else { this.m_CustomTimeScripts.Add(allScript); } } } this.m_CustomTimeScripts.Add(ScriptExecutionOrderInspector.sDummyScript); this.m_CustomTimeScripts.Add(ScriptExecutionOrderInspector.sDummyScript); this.m_CustomTimeScripts.Sort((IComparer <MonoScript>) new ScriptExecutionOrderInspector.SortMonoScriptExecutionOrder(this)); this.m_DefaultTimeScripts.Sort((IComparer <MonoScript>) new ScriptExecutionOrderInspector.SortMonoScriptNameOrder()); this.m_Edited = (MonoScript)null; this.m_DirtyOrders = false; }
private void OnDisable() { foreach (MonoScript current in this.m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = null; }
private void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= new AssemblyReloadEvents.AssemblyReloadCallback(base.Close); foreach (MonoScript current in this.m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(current); } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = null; }
private void Apply() { var changedIndices = new List <int>(); var changedScripts = new List <MonoScript>(); for (int i = 0; i < m_AllScripts.Length; i++) { if (MonoImporter.GetExecutionOrder(m_AllScripts[i]) != m_AllOrders[i]) { changedIndices.Add(i); changedScripts.Add(m_AllScripts[i]); } } bool editable = true; if (Provider.enabled) { var needToCheckout = new AssetList(); foreach (var s in changedScripts) { var asset = Provider.GetAssetByPath(AssetDatabase.GetAssetPath(s)); if (asset == null) // script might be outside of the project (e.g. in a package) { continue; } if (AssetDatabase.IsMetaFileOpenForEdit(s, StatusQueryOptions.UseCachedIfPossible)) { continue; // might not need a checkout (not connected, etc.) } needToCheckout.Add(asset); } if (needToCheckout.Any()) { var task = Provider.Checkout(needToCheckout, CheckoutMode.Meta); task.Wait(); editable = task.success; } } if (editable) { foreach (int index in changedIndices) { MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]); } PopulateScriptArray(); } else { Debug.LogError("Could not checkout scrips in version control for changing script execution order"); } }
void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= Close; // When window closes we copy all changes to monoimporters (reimport monoScripts) foreach (MonoScript monoScript in m_MonoScriptIconsChanged) { MonoImporter.CopyMonoScriptIconToImporters(monoScript); } s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; s_AnnotationWindow = null; }
private void OnDisable() { using (List <MonoScript> .Enumerator enumerator = this.m_MonoScriptIconsChanged.GetEnumerator()) { while (enumerator.MoveNext()) { MonoImporter.CopyMonoScriptIconToImporters(enumerator.Current); } } AnnotationWindow.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AnnotationWindow.s_AnnotationWindow = (AnnotationWindow)null; }
private void Apply() { var changedIndices = new List <int>(); var changedPaths = new List <string>(); for (var i = 0; i < m_AllScripts.Length; i++) { var script = m_AllScripts[i]; if (MonoImporter.GetExecutionOrder(script) == m_AllOrders[i]) { continue; } var assetPath = AssetDatabase.GetAssetPath(script); if (string.IsNullOrEmpty(assetPath)) // Script might be outside of the project (e.g. in a package). { continue; } var metaPath = AssetDatabase.GetTextMetaFilePathFromAssetPath(assetPath); if (!AssetDatabase.CanOpenForEdit(metaPath)) { continue; } changedIndices.Add(i); if (!AssetDatabase.IsOpenForEdit(metaPath)) // No VCS enabled, not connected, already checked out, etc. { changedPaths.Add(metaPath); } } if (!AssetDatabase.MakeEditable(changedPaths.ToArray())) { Debug.LogError("Could not make scrips editable for changing script execution order."); return; } foreach (var index in changedIndices) { MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]); } PopulateScriptArray(); }
private void SaveIconChanges() { if (EditorGUIUtility.GetIconForObject(this.m_TargetObject) != this.m_StartIcon) { MonoScript targetObject = this.m_TargetObject as MonoScript; if (targetObject != null) { if (this.m_MonoScriptIconChangedCallback != null) { this.m_MonoScriptIconChangedCallback(targetObject); } else { MonoImporter.CopyMonoScriptIconToImporters(targetObject); } } } }
private void ShowFieldInfo(Type type, MonoImporter importer, List <string> names, List <UnityEngine.Object> objects, ref bool didModify) { if (!MonoScriptImporterInspector.IsTypeCompatible(type)) { return; } this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; int i = 0; while (i < array.Length) { FieldInfo fieldInfo = array[i]; if (fieldInfo.IsPublic) { goto IL_67; } object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(SerializeField), true); if (customAttributes != null && customAttributes.Length != 0) { goto IL_67; } IL_EC: i++; continue; IL_67: if (!fieldInfo.FieldType.IsSubclassOf(typeof(UnityEngine.Object)) && fieldInfo.FieldType != typeof(UnityEngine.Object)) { goto IL_EC; } UnityEngine.Object defaultReference = importer.GetDefaultReference(fieldInfo.Name); UnityEngine.Object @object = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(fieldInfo.Name), defaultReference, fieldInfo.FieldType, false, new GUILayoutOption[0]); names.Add(fieldInfo.Name); objects.Add(@object); if (defaultReference != @object) { didModify = true; goto IL_EC; } goto IL_EC; } }
private void ShowFieldInfo(Type type, MonoImporter importer, List<string> names, List<UnityEngine.Object> objects, ref bool didModify) { if (!MonoScriptImporterInspector.IsTypeCompatible(type)) { return; } this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo[] array = fields; int i = 0; while (i < array.Length) { FieldInfo fieldInfo = array[i]; if (fieldInfo.IsPublic) { goto IL_67; } object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(SerializeField), true); if (customAttributes != null && customAttributes.Length != 0) { goto IL_67; } IL_EC: i++; continue; IL_67: if (!fieldInfo.FieldType.IsSubclassOf(typeof(UnityEngine.Object)) && fieldInfo.FieldType != typeof(UnityEngine.Object)) { goto IL_EC; } UnityEngine.Object defaultReference = importer.GetDefaultReference(fieldInfo.Name); UnityEngine.Object @object = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(fieldInfo.Name), defaultReference, fieldInfo.FieldType, false, new GUILayoutOption[0]); names.Add(fieldInfo.Name); objects.Add(@object); if (defaultReference != @object) { didModify = true; goto IL_EC; } goto IL_EC; } }
private void SaveIconChanges() { if (!((UnityEngine.Object)EditorGUIUtility.GetIconForObject(this.m_TargetObject) != (UnityEngine.Object) this.m_StartIcon)) { return; } MonoScript targetObject = this.m_TargetObject as MonoScript; if (!((UnityEngine.Object)targetObject != (UnityEngine.Object)null)) { return; } if (this.m_MonoScriptIconChangedCallback != null) { this.m_MonoScriptIconChangedCallback(targetObject); } else { MonoImporter.CopyMonoScriptIconToImporters(targetObject); } }
void PopulateScriptArray() { m_AllScripts = MonoImporter.GetAllRuntimeMonoScripts(); m_AllOrders = new int[m_AllScripts.Length]; // Create cleaned up list of scripts m_CustomTimeScripts = new List <MonoScript>(); m_DefaultTimeScripts = new List <MonoScript>(); for (int i = 0; i < m_AllScripts.Length; i++) { MonoScript script = m_AllScripts[i]; m_AllOrders[i] = MonoImporter.GetExecutionOrder(script); if (!IsValidScript(script)) { continue; } if (GetExecutionOrder(script) == 0) { m_DefaultTimeScripts.Add(script); } else { m_CustomTimeScripts.Add(script); } } // Add two dummy items used for the default time area m_CustomTimeScripts.Add(sDummyScript); m_CustomTimeScripts.Add(sDummyScript); // Assign and sort m_CustomTimeScripts.Sort(new SortMonoScriptExecutionOrder(this)); m_DefaultTimeScripts.Sort(new SortMonoScriptNameOrder()); m_Edited = null; m_DirtyOrders = false; }
void SaveIconChanges() { Texture2D currentIcon = EditorGUIUtility.GetIconForObject(m_TargetObject); // Only save if we had any changes if (currentIcon != m_StartIcon) { MonoScript monoScript = m_TargetObject as MonoScript; if (monoScript != null) { // If callback is set then it is the callback owner responsiblity to call CopyMonoScriptIconToImporters if (m_MonoScriptIconChangedCallback != null) { m_MonoScriptIconChangedCallback(monoScript); } else { MonoImporter.CopyMonoScriptIconToImporters(monoScript); } } } }
private void Apply() { List <int> intList = new List <int>(); List <MonoScript> monoScriptList = new List <MonoScript>(); for (int index = 0; index < this.m_AllScripts.Length; ++index) { if (MonoImporter.GetExecutionOrder(this.m_AllScripts[index]) != this.m_AllOrders[index]) { intList.Add(index); monoScriptList.Add(this.m_AllScripts[index]); } } bool flag = true; if (Provider.enabled) { Task task = Provider.Checkout((UnityEngine.Object[])monoScriptList.ToArray(), CheckoutMode.Meta); task.Wait(); flag = task.success; } if (flag) { using (List <int> .Enumerator enumerator = intList.GetEnumerator()) { while (enumerator.MoveNext()) { int current = enumerator.Current; MonoImporter.SetExecutionOrder(this.m_AllScripts[current], this.m_AllOrders[current]); } } this.PopulateScriptArray(); } else { Debug.LogError((object)"Could not checkout scrips in version control for changing script execution order"); } }
private void Apply() { var changedIndices = new List <int>(); var changedScripts = new List <MonoScript>(); for (int i = 0; i < m_AllScripts.Length; i++) { if (MonoImporter.GetExecutionOrder(m_AllScripts[i]) != m_AllOrders[i]) { changedIndices.Add(i); changedScripts.Add(m_AllScripts[i]); } } bool editable = true; if (Provider.enabled) { var task = Provider.Checkout(changedScripts.ToArray(), CheckoutMode.Meta); task.Wait(); editable = task.success; } if (editable) { foreach (int index in changedIndices) { MonoImporter.SetExecutionOrder(m_AllScripts[index], m_AllOrders[index]); } PopulateScriptArray(); } else { Debug.LogError("Could not checkout scrips in version control for changing script execution order"); } }
private void ShowFieldInfo(System.Type type, MonoImporter importer, List<string> names, List<UnityEngine.Object> objects, ref bool didModify) { if (!MonoScriptImporterInspector.IsTypeCompatible(type)) return; this.ShowFieldInfo(type.BaseType, importer, names, objects, ref didModify); foreach (System.Reflection.FieldInfo field in type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)) { if (!field.IsPublic) { object[] customAttributes = field.GetCustomAttributes(typeof (SerializeField), true); if (customAttributes == null || customAttributes.Length == 0) continue; } if (field.FieldType.IsSubclassOf(typeof (UnityEngine.Object)) || field.FieldType == typeof (UnityEngine.Object)) { UnityEngine.Object defaultReference = importer.GetDefaultReference(field.Name); UnityEngine.Object @object = EditorGUILayout.ObjectField(ObjectNames.NicifyVariableName(field.Name), defaultReference, field.FieldType, false, new GUILayoutOption[0]); names.Add(field.Name); objects.Add(@object); if (defaultReference != @object) didModify = true; } } }
private static string GetObjectTypeName(UnityEngine.Object o) { string result; if (o == null) { result = "Nothing Selected"; } else if (o is GameObject) { result = o.name; } else if (o is TagManager) { result = "Tags & Layers"; } else if (o is Component) { MonoBehaviour monoBehaviour = o as MonoBehaviour; if (monoBehaviour) { string scriptClassName = monoBehaviour.GetScriptClassName(); if (scriptClassName == "InvalidStateMachineBehaviour") { result = monoBehaviour.name + " (Script)"; } else { result = scriptClassName + " (Script)"; } } else { MeshFilter meshFilter = o as MeshFilter; if (meshFilter) { Mesh sharedMesh = meshFilter.sharedMesh; result = ((!sharedMesh) ? "[none]" : sharedMesh.name) + " (MeshFilter)"; } else { result = o.GetType().Name; } } } else if (o is AssetImporter) { MonoImporter monoImporter = o as MonoImporter; if (monoImporter) { MonoScript script = monoImporter.GetScript(); result = "Default References (" + ((!script) ? string.Empty : script.name) + ")"; } else { SubstanceImporter substanceImporter = o as SubstanceImporter; if (substanceImporter) { MonoScript substanceArchive = substanceImporter.GetSubstanceArchive(); if (substanceArchive) { result = substanceArchive.name + " (Substance Archive)"; return(result); } } result = o.GetType().Name; } } else { result = o.name + " (" + o.GetType().Name + ")"; } return(result); }