DrawGUITexture in script?

Hey guys, is it possible to draw a gui texture in script? Any ideas?

-Thanks! :slight_smile:

Do you mean something like this:
http://docs.unity3d.com/ScriptReference/GUI.DrawTexture.html ?

Currently im using this one. But i need it to be specificly a GUITexture, so i could do a HitTest. With this one i cant. Maybe you know a way i could call a touch on Texture2D?

Is this at all helpful? It seems it may address what you want. Unity - Scripting API: RaycastHit.textureCoord

Meh, ended up working with DrawTexture. It would have been easy to do this with mousePosition, but in this case i needed touch, so thats why i wanted GuiTexture, so i could use HitTest. But with DrawTexture i couldnt.

Thanks for the help tho guys.

In case you would like to see the code:

GUI.DrawTexture(slotRect, slots[i].itemIcon);


foreach (Touch touch in Input.touches)
                    { 
                        Vector3 inputGuiPosition = touch.position;
                        inputGuiPosition.y = Screen.height - inputGuiPosition.y;

                        if(Input.touchCount > 0)
                        {
                            if(slotRect.Contains(inputGuiPosition))
                            {
                                ItemRec(slots[i]);
                                //Debug.Log(currentItemId);
                                if(currentItemId == 2)
                                {
                                    Debug.Log("Touched Ms");
                                }

                                if(currentItemId == 3)
                                {
                                   Debug.Log("Touched Mn");
                                }
                            }
                        }
                    }