My code creates a sprite texture from a asset. It then clears the bottom pixel of that sprite. That works fine, but what I don’t get is that the actual itself that I created the sprite from also has a cleared pixel, and until I reset Unity it stays that way. So why/how is that happening? here’s a screen shot Unity to show you what I mean.
And here’s the code I’m using that does that.
backSprite = Resources.Load(assetName, typeof(Sprite)) as Sprite;
//Create a new gameobject
obj = new GameObject("RedSquare");
//Attach a SpriteRenender to the newly created gameobject
SpriteRenderer rend = obj.AddComponent(typeof(SpriteRenderer)) as SpriteRenderer;
//obj.transform.position = new Vector2 (0, 0);
//Assign the sprite to the SpriteRenender
rend.sprite = backSprite;
increment = 0;
speed = 4;
startPoint = transform.position;
endPoint = transform.position;
myTexture = backSprite.texture;
MyPixel = myTexture.GetPixel(0,0);
myTexture.SetPixel (0, 0, Color.clear);
myTexture.Apply ();