- Home /
Question by
guptayash0270 · Jun 11, 2018 at 06:00 AM ·
unity 5uiguiguitextureguitext
Drawing UI text on GUI.DrawTexture , How to do it ?
I am building a bar code scanner , and needs to show the barcode data on GUI.DrawTexture
the code is :
GUI.depth = 100; //this method is not working
GUI.DrawTexture(screenRect, camTexture, ScaleMode.ScaleToFit); // {draws the camera screen on screen .I am using camTextue to used zxing ( barcode scanner library ) to get the barcode data , so needed it }
Now i want to use UI text compponent to show on it . I have tried Z axis method or GUI.Depth method nothing is working . Always the GUI.DrawTexture is above the text .
Please anyone know how to do it .
Comment
Answer by bakir-omarov · Jun 11, 2018 at 08:08 AM
You can use Gui.Label , It is working for me (Unity 2017.3.1f1):
void OnGUI()
{
GUI.contentColor = Color.black;
GUI.DrawTexture(new Rect(40, 40, 98, 100), texture);
GUI.Label(new Rect(68, 72, 80, 20), "Text");
}
2018-06-11-12-07-05.jpg
(2.1 kB)
Your answer
Follow this Question
Related Questions
Fix Blurry UI text? 10 Answers
Collapsible Side Menu 1 Answer
When loading into a new scene my UI doesn't work anymore? 3 Answers
How to draw GUI texture under UI elements? 0 Answers
Unity3d GUI Element Scaling 1 Answer