I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can’t be done at this point in time.
Let’s say I have a sprite sheet that has already been split up into individual sprites inside of Unity.
I am attempting to change the sub-sprite names programmatically.
I tried using
AssetDatabase.RenameAsset (...)
on the sprite sheet asset, which only changes the sprite sheet name and not sub-sprites.
I then obtained a sub-sprite and attempted to change its name using the below code.
if (AssetDatabase.IsSubAsset (subSprite))
{
AssetDatabase.RenameAsset (AssetDatabase.GetAssetPath (subSprite), "newSprite" + i.ToString ());
}
However, this too only changes the sprite sheet name.
I’m not sure where else I can take this to achieve my desired outcome, apart from programmatically copying the original sprite sheet and using that to create a copy. But even then, I still am unable to alter the sub-sprite names.
I also tried changing subSprite.name, but this just changes the internal name and not the asset name.
Any ideas?