Using spiresheet in c# code

Hi,

I have some public variables, like this code below:

public Texture2D myImage;

I put all my graphics in a spritesheet atlas, sliced them and want to use one of those sprites in my C# code. But I cant use them since my variable is Texture2D.

Is there a way to use SpriteSheet images as Texture2D ?

Why don’t you use

public Sprite myImage;

?

–Eric

can’t :frowning:
want to use that sprite it on GUI.DrawTexture (which only takes Texure2D to draw)
wish we got smt like GUI.DrawSprite.

You can use GUI.DrawTextureWithTexCoords.

–Eric