- Home /
Question by
Iceblitzyt · Aug 26, 2013 at 04:42 PM ·
c# dll
How can i load resources with a path?? c#
So im trying to load resources with a certain path.
I'm currently doing this: using UnityEngine; using System.Collections;
public abstract class SpellDataBase {
private string TexturePath = "GameArt/SpellIcons/";
public Texture2D icon;
private PlayerHUD owner;
public abstract void Cast();
public class FireBall : SpellDataBase
{
public FireBall(PlayerHUD owner)
{
this.owner = owner;
this.icon = Resources.Load(TexturePath + "FireBall") as Texture2D;
}
public override void Cast()
{
Debug.Log("FireBall casted...");
}
}
}
But I get no luck, can someone please assist me. I tried looking on the forums, but the fixes don't work.
Comment
Best Answer
Answer by perchik · Aug 26, 2013 at 04:50 PM
Resources.Load
only *loads an asset stored at path in a Resources folder.*
and my guess is that GameArt is not in the Resources folder under assets
So I put the game art folder inside of the Resources folder.
I changed my texture path to "Resources/GameArt/SpellIcons/", i still get nothing.. Even if i change it to "/GameArt/SpellIcons/"
The texture path is not the problem. The actual GameArt folder must be inside Assets/Resources/