UnityEditor.CustomEditorAttributes.FindCustomEditorTypeByType C# (CSharp) Method

FindCustomEditorTypeByType() static private method

static private FindCustomEditorTypeByType ( Type type, bool multiEdit ) : Type
type System.Type
multiEdit bool
return System.Type
        internal static Type FindCustomEditorTypeByType(Type type, bool multiEdit)
        {
            if (!s_Initialized)
            {
                Assembly[] loadedAssemblies = EditorAssemblies.loadedAssemblies;
                for (int i = loadedAssemblies.Length - 1; i >= 0; i--)
                {
                    Rebuild(loadedAssemblies[i]);
                }
                s_Initialized = true;
            }
            if (type != null)
            {
                Type inspectorType;
                Dictionary<Type, Type> dictionary = !multiEdit ? kCachedEditorForType : kCachedMultiEditorForType;
                if (dictionary.TryGetValue(type, out inspectorType))
                {
                    return inspectorType;
                }
                List<MonoEditorType> list = !multiEdit ? kSCustomEditors : kSCustomMultiEditors;
                for (int j = 0; j < 2; j++)
                {
                    for (Type type4 = type; type4 != null; type4 = type4.BaseType)
                    {
                        for (int k = 0; k < list.Count; k++)
                        {
                            if (IsAppropriateEditor(list[k], type4, type != type4, j == 1))
                            {
                                inspectorType = list[k].m_InspectorType;
                                dictionary.Add(type, inspectorType);
                                return inspectorType;
                            }
                        }
                    }
                }
                dictionary.Add(type, null);
            }
            return null;
        }