Change Sprite Renderer Image Script Unity Code Example


Example 1: change sprite of gameobject unity

gameObjectName.GetComponent<SpriteRenderer>().sprite = spriteName;

Example 2: change sprite of a sprite unity

public SpriteRenderer spriteRenderer; public Sprite newSprite;  void ChangeSprite()     {         spriteRenderer.sprite = newSprite;      }

Comments

Popular posts from this blog

Chemistry - Bond Angles In NH3 And NCl3

Are Regular VACUUM ANALYZE Still Recommended Under 9.1?

Change The Font Size Of Visual Studio Solution Explorer