Example #1
0
        private static UnityEngine.Object Load(string filename, Type type)
        {
            UnityEngine.Object @object = AssetDatabase.LoadAssetAtPath("Assets/Editor Default Resources/" + filename, type);
            if (@object != null)
            {
                return(@object);
            }
            AssetBundle editorAssetBundle = EditorGUIUtility.GetEditorAssetBundle();

            if (editorAssetBundle == null)
            {
                if (Application.isBatchmode)
                {
                    return(null);
                }
                throw new NullReferenceException("Failure to load editor resource asset bundle.");
            }
            else
            {
                @object = editorAssetBundle.LoadAsset(filename, type);
                if (@object != null)
                {
                    return(@object);
                }
                return(AssetDatabase.LoadAssetAtPath(filename, type));
            }
        }
 private static UnityEngine.Object Load(string filename, Type type)
 {
     UnityEngine.Object @object = AssetDatabase.LoadAssetAtPath("Assets/Editor Default Resources/" + filename, type);
     if (@object != null)
     {
         return(@object);
     }
     return(EditorGUIUtility.GetEditorAssetBundle().LoadAsset(filename, type));
 }