Hello Guest

Author Topic: LoadResourceByName  (Read 3536 times)

edo

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 9
    • View Profile
LoadResourceByName
« on: January 28, 2014, 11:15:03 am »
Hi,
I'm trying to change Sprite Collection at Runtime using:

// init
tk2dSpriteCollectionData fruitCollection;

// start
fruitCollection = tk2dSystem.LoadResourceByName<tk2dSpriteCollectionData>("BananaSpriteCollection") as tk2dSpriteCollectionData;

// function
MyFruitsImage[z].SetSprite(fruitCollection, "Banana_Idle0001");

i've set the loadable asset.
i've build the index again.
i get no error or nothing on run time but it's not working.
any idea why?

tnx,
Edo

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: LoadResourceByName
« Reply #1 on: January 28, 2014, 11:26:56 am »
tk2dSystem.LoadResourceByName is undocumented because it isn't supported / tested for use outside the platform sprite collections. You will have to debug this to work out why it isn't working - if it didn't work I would expect a null ref error.

If you want to load sprite collections at runtime you can always put the data object in a Resources directory and use Resources.Load to load it.