Hello,
I am trying to change the sprite collection at run time as follows :-
BearAnimation.m_Collection = Resources.Load(BasePath.m_BasePathForCollections+"Hyderate" , typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
BearAnimation.m_AnimationObject.GetComponent<tk2dBaseSprite>().SetSprite(BearAnimation.m_Collection,1);
but if give following error :-
Object reference not found at line
collectionInst = collection.inst;
in following function
public void SetSprite(tk2dSpriteCollectionData newCollection, int newSpriteId) {
bool switchedCollection = false;
if (Collection != newCollection) {
collection = newCollection;
collectionInst = collection.inst;
_spriteId = -1; // force an update, but only when the collection has changed
switchedCollection = true;
}
it essentially means there is no sprite collection already set , which is not true as I have attached one.
Please suggest how I can swap sprite collections at run time ?