- Home /
Question by
MisschienWelChristiaan · Apr 01, 2017 at 07:11 AM ·
sprites
How do i remove the parent spritesheet name in all sliced sprites?
So yeah, i have this issue right now where i have a ton of spritesheets for items. Like every single spritesheet is it's own item. and it's like this *spritesheetname*_*sprite*
.
However i want to remove the *spritesheetname*
so it's only *sprite*
.
so i tried to make this script :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FixSprites : MonoBehaviour {
public string Part;
// Use this for initialization
void Start () {
var subSprites = Resources.LoadAll<Sprite> ("Textures/"+Part+"/");
foreach (Sprite item in subSprites) {
string input = item.ToString ();
string output = input.Substring (input.IndexOf ('_') + 1);
item.name = output;
Debug.Log (item.name);
}
}
// Update is called once per frame
void Update () {
}
}
However it doesn't save them. Is there any other way i can tackle this issue? Thanks,
Comment