Skip to content

Instantly share code, notes, and snippets.

@liortal53
Last active September 14, 2015 17:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liortal53/47a5b7afa1833391db34 to your computer and use it in GitHub Desktop.
Save liortal53/47a5b7afa1833391db34 to your computer and use it in GitHub Desktop.
ResourcesEx - a wrapper for Unity's Resources class
using UnityEngine;
using System;
/// <summary>
/// Wrapper class around Unity's built-in Resources class.
/// </summary>
public class ResourcesEx
{
public static UnityEngine.Object Load(string path)
{
Debug.Log (string.Format("Loading from Resources: {0}", path));
return Resources.Load(path);
}
public static UnityEngine.Object Load(string path, Type type)
{
Debug.Log (string.Format("Loading from Resources: {0} Type: {1}", path, type.Name));
return Resources.Load(path, type);
}
public static T Load<T> (string path) where T : UnityEngine.Object
{
Debug.Log (string.Format("Loading from Resources: {0} Type: {1}", path, typeof(T).Name));
return Resources.Load<T>(path);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment