Hello,
I'm attempting to create a slicedsprite at runtime. I have already created an atlas along with a few sprites in the editor, so there's already an "inventory" atlas which I placed (total 3 files, inventory.mat/.prefab/.png) under Assets/Resources/ (also tried Assets/Resources/inventory/). My code to add new sprite is like this:
void Start () {
UISlicedSprite sp1 = NGUITools.AddWidget<UISlicedSprite>(GameObject.Find("Panel"));
GameObject atlas = Instantiate( Resources.Load("inventory")) as GameObject;
sp1.atlas = atlas.GetComponent<UIAtlas>();
sp1.spriteName = "item_A_Tr";
}
I also tried without the instantiate:
GameObject atlas = Resources.Load("inventory") as GameObject;
It seems like no matter what the resources.load always returns null. All the examples I found online are using pre-existing atlas packages like scifi atlas or fantasy atlas, but here I'm using a custom atlas, not sure if I'm doing everything right?
Thanks!