UnityEditor.CustomEditorAttributes.FindCustomEditorType C# (CSharp) Method

FindCustomEditorType() static private method

static private FindCustomEditorType ( Object o, bool multiEdit ) : Type
o Object
multiEdit bool
return System.Type
        internal static Type FindCustomEditorType(Object o, bool multiEdit)
        {
            return FindCustomEditorTypeByType(o.GetType(), multiEdit);
        }

Usage Example

        public static Texture2D CreatePreviewForAsset(UnityEngine.Object obj, UnityEngine.Object[] subAssets, string assetPath)
        {
            if (obj == null)
            {
                return(null);
            }
            System.Type type = CustomEditorAttributes.FindCustomEditorType(obj, false);
            if (type == null)
            {
                return(null);
            }
            MethodInfo method = type.GetMethod("RenderStaticPreview");

            if (method == null)
            {
                Debug.LogError("Fail to find RenderStaticPreview base method");
                return(null);
            }
            if (method.DeclaringType == typeof(Editor))
            {
                return(null);
            }
            Editor editor = Editor.CreateEditor(obj);

            if (editor == null)
            {
                return(null);
            }
            Texture2D textured = editor.RenderStaticPreview(assetPath, subAssets, 0x80, 0x80);

            UnityEngine.Object.DestroyImmediate(editor);
            return(textured);
        }
All Usage Examples Of UnityEditor.CustomEditorAttributes::FindCustomEditorType