Hi I am having a png file downloaded from server.
I have to create a sprite at run time out of texture is there any easy method to do this
public SpriteRenderer bg;
void change()
{
Texture2D sprites = Resources.Load<Texture2D>("lev1/"+name*) ;*
-
Rect rec = new Rect(0, 0, sprites.width, sprites.height);*
-
Sprite.Create(sprites,rec,new Vector2(0,0),1);*
-
bg.sprite = Sprite.Create(sprites,rec,new Vector2(0,0),.01f);}*
I used this code but the sprite that is formed is very large than expected
As i change this texture to sprite from the inspector and then drag and drop this sprite set my camera according to it and
and then change the back sprite to texture and use the I code to convert the texture to sprite I get different result …