Skip to content

Instantly share code, notes, and snippets.

@JT5D
Forked from unitycoder/gist:2be9dea1acde0c210f94
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save JT5D/81865d2d59cac03a331f to your computer and use it in GitHub Desktop.

Select an option

Save JT5D/81865d2d59cac03a331f to your computer and use it in GitHub Desktop.
// need to create new sprite, cannot assign or convert Texture2D into sprite
Sprite sprite = Sprite.Create (tex, new Rect(0,0,tex.width,tex.height), new Vector2 (0, 0), pixelToUnits);
GetComponent<SpriteRenderer>().sprite = sprite;
http://docs.unity3d.com/ScriptReference/Sprite.Create.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment