Skip to content

Commit 2e2cfbc

Browse files
committed
Simplification
1 parent 1628493 commit 2e2cfbc

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

Assets/SpriteSheetRuntimeGenerator/Demos/Scripts/LoadTextures.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ void Start () {
2424

2525
void LaunchAnimations() {
2626

27-
StartCoroutine(LoadAnimation ());
27+
StartCoroutine(LoadAnimation());
2828
}
2929

3030
IEnumerator LoadAnimation() {
@@ -44,14 +44,7 @@ IEnumerator LoadAnimation() {
4444
TextureAsset asset = null;
4545
assets.TryGetValue("walking0004", out asset);
4646

47-
Color[] colors = loaderTexture.texture.GetPixels(asset.x, asset.y, asset.width, asset.height);
48-
49-
Texture2D texture = new Texture2D(asset.width, asset.height, TextureFormat.ARGB32, false);
50-
51-
anim.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero);
52-
53-
anim.sprite.texture.SetPixels(colors);
54-
47+
anim.sprite = Sprite.Create(loaderTexture.texture, new Rect(asset.x, asset.y, asset.width, asset.height), Vector2.zero);
5548
}
5649

5750
void CopyPasteFoldersAndPNG(string SourcePath, string DestinationPath) {

0 commit comments

Comments
 (0)