In Preveiw 3 ,there is a “registeredSpriteAtlasTags” property in Sprite which can solve my problem.See Access RuntimeSpriteAtlas from sprite - Unity Engine - Unity Discussions
But I can’t found it or in Preview4 and Unity 2017 beta7,It looks like Unity2017 will ship the final 2D Atals release.Is this property removed forever? I really need it.
Currently that has been removed. Could you provide more details how you were using it? I read the post you linked, maybe a bit more detail in the process would help us understand the usefulness.
I wrote a demo to explain why I need atlas infomation (tag or reference) from a sprite,check out the attached file and run test scene.
The key code :
void LocalizedSpriteRenderer(SpriteRenderer sptRenderer, Language language) {
string atlasName;
//solution 1 : get atlasName from a custom record :(
atlasName = sptRenderer.GetComponent<CustomAtlasRecord>().SpriteTag;
//if we have a property like Sprite.tags,I will not need a CustomRecord :)
//atlasName=sptRenderer.sprite.tags[0];//most sprite only have one tag
//make atlasName to localized AtlasName
var localizedAtlasName = language + "/" + atlasName;
//load atlas from Resources
var localizedAtlas = Resources.Load<SpriteAtlas>(localizedAtlasName);
//get correspond sprite
string currentlySpriteName = sptRenderer.sprite.name;
sptRenderer.sprite = localizedAtlas.GetSprite(currentlySpriteName);
sptRenderer.sprite.name = currentlySpriteName;//... why a sprite get from atlas called xxx(clone) :(
}
BTW: Where is the " Runtime swap atlases and automatically rebind with loaded sprite renderers " feature ,the roadmap show it ,but can’t found.
3088389–232794–AtlasLocalized.zip (80.3 KB)