I found what was the problem. I probably didn't understood you right. When you said "Try this background_sprite.SetSprite( newCollection, sprite_name );", did you mean try only with this or after these two lines?
background_sprite.Collection = Resources.Load(collection_name, typeof(tk2dSpriteCollectionData)) as tk2dSpriteCollectionData;
background_sprite.spriteId = background_sprite.Collection.GetSpriteIdByName(sprite_name);
Anyway, I used my old code and then wrote your line and this is wrong because of this part of code:
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;
}
spriteId = newSpriteId;
if (switchedCollection) {
UpdateMaterial();
}
}
In my case UpdateMaterial() would never be called. Now I'm loading a sprite collection from resource and only calling SetSprite function without explicitly assigning new collection and spriteId. I don't know if this is wanted behavior, maybe a Collection set function should call UpdateMaterial...
Tnx for your help and speed...