Beispiel #1
0
        public static T LoadResource <T>(string path) where T : Object
        {
            var resource = StyleSheetResourceUtil.LoadResource(path, typeof(T)) as T;

            if (resource == null)
            {
                // It might be a builtin resource:
                resource = Resources.GetBuiltinResource <T>(path);
            }
            return(resource);
        }
Beispiel #2
0
        public static T LoadResourceRequired <T>(string path) where T : Object
        {
            var resource = StyleSheetResourceUtil.LoadResource(path, typeof(T)) as T;

            if (resource == null)
            {
                // It might be a builtin resource:
                resource = Resources.GetBuiltinResource <T>(path);
            }

            if (resource == null)
            {
                throw new Exception("Cannot load resource: " + path);
            }

            return(resource);
        }
 internal static UnityEngine.Object LoadResource(string pathName, Type type)
 {
     return(StyleSheetResourceUtil.LoadResource(pathName, type, GUIUtility.pixelsPerPoint > 1f));
 }