Hello Guest

Author Topic: SpriteCollection in Resources  (Read 4037 times)

emmettoc

  • Newbie
  • *
  • Posts: 1
    • View Profile
SpriteCollection in Resources
« on: September 26, 2013, 08:37:12 am »
Hello,

I want to load sprite collections in code, so I move them in "Resources" directory. But the following error appears:
 
Quote
Spirit Collection is in a resources directory. All source textures will be included in build.

What actually does this mean? Should not I use sprite collections in "Resources"?

Thank you.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: SpriteCollection in Resources
« Reply #1 on: September 26, 2013, 12:07:05 pm »
You only need to move the sprite collection data object. That is what you'll load at runtime and feed into tk2dSprite.SetSprite(...)

wagenheimer

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 50
    • View Profile
Re: SpriteCollection in Resources
« Reply #2 on: February 19, 2014, 01:48:26 pm »
I need to change the SpriteCollection on Code.

I added a variable public tk2dSpriteCollectionData spriteCollection where I set the SpriteColletion in Editor.

So after I can use :

spriteItem.SetSprite(spriteCollection, id);

But If I use this variable, all source images from SpriteCollection seems to be loaded. How the correct way of doing this?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: SpriteCollection in Resources
« Reply #3 on: February 19, 2014, 01:53:05 pm »
The source images won't be loaded if you're only referencing tk2dSpriteCollectionData. There is no reference to them in there. If you put something in resources, make sure its ONLY the data object and nothing else.