2D Toolkit Forum

2D Toolkit => Support => Topic started by: brain56 on September 19, 2012, 02:30:16 am

Title: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
Post by: brain56 on September 19, 2012, 02:30:16 am
Noob question. Haha. I'd like to extract the tk2dSpriteCollectionData from a given tk2dSpriteCollection. How do I do this? I can't seem to find any methods related to this. Thanks!  ;D
Title: Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
Post by: unikronsoftware on September 19, 2012, 09:50:50 am
The member you want is .spriteCollection
Why do you need this? Its probably not a good idea to rely on this - the next version will have more than 1 data object attached to one object for runtime atlas swapping, etc. If you tell me your needs then perhaps I could suggest something which won't break in the next version.
Title: Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
Post by: wagenheimer on November 25, 2013, 05:36:04 pm
Well... I need to change the SpriteCollection from the sprite in RunTime, how this is possible without breaking anything (SetSprite requires a SpriteCollectionData for this)?
Title: Re: Extracting tk2dSpriteCollectionData from tk2dSpriteCollection
Post by: unikronsoftware on November 25, 2013, 06:26:42 pm
Why do you need to assign the SpriteCollection rather than the data object? The SpriteCollection itself contains references to your source images, etc. and should never be used at runtime. The data object is what contains the optimised atlas and no references to the source images.