#region Utility methods
///
/// Get a Texture2D from the path provided
///
/// File name to check
/// Texture if found or null
public static Texture2D GetTexture2D(string fileName)
{
Texture2D resource = null;
#if UNITY_EDITOR
resource = PWCommon.Utils.GetAsset(fileName, typeof(UnityEngine.Texture2D)) as Texture2D;
#endif
return resource;
}
///
/// Get a Game Object from the path provided
///
/// Path to check
/// GameObject if found or null
public static GameObject GetGameObject(string fileName)
{
GameObject resource = null;
#if UNITY_EDITOR
resource = PWCommon.Utils.GetAsset(fileName, typeof(UnityEngine.GameObject)) as GameObject;
#endif
return resource;
}
///
/// Get a spawn rule extension
///
/// Path to check
/// GameObject if found or null
public static Gaia.SpawnRuleExtension GetSpawnRuleExtension(string fileName)
{
Gaia.SpawnRuleExtension extension = null;
#if UNITY_EDITOR
GameObject resource = PWCommon.Utils.GetAsset(fileName, typeof(UnityEngine.GameObject)) as GameObject;
if (resource != null)
{
extension = resource.GetComponent();
}
#endif
return extension;
}
///
/// Get the resource from the ID provided
///
/// Resource with the given ID to check
/// Resource with the given ID to check
/// Resource if found or null
public static Gaia.GaiaResource GetResource(string fileName, string id)
{
Gaia.GaiaResource resource = null;
#if UNITY_EDITOR
resource = PWCommon.Utils.GetAsset(fileName, typeof(Gaia.GaiaResource)) as Gaia.GaiaResource;
#endif
return resource;
}
#endregion
}
}
#endif