- Home /
Change a sprite from url
Basicly I'm trying to change a player picture based on his picture online. I've found a way to create sprites and change that picture (http://answers.unity3d.com/questions/581524/creating-sprite-in-code-using-textureimporter-with.html) but what I want its to change a current sprite and I'm not being able to adapt that code.
This is what I've tried:
IEnumerator User1()
{
//can be used to load textures from url OR from local computer/device
WWW www = new WWW(url);
yield return www;
Sprite sprite = new Sprite();
sprite = Sprite.Create(www.texture,new Rect(0, 0, 170, 170),new Vector2(0, 0),100.0f);
user1.gameObject.GetComponent<SpriteRenderer>().sprite = sprite;
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613151455im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Resources.Load("sprite") returning nil 0 Answers
Accessing 4.6 GUI build-in sprites in C# 0 Answers
Save / Load high score online 2 Answers
How to load a sprite via WWW on IOS? 1 Answer