Is it possible to draw primitive shapes on to a Texture2D?
So I'm trying to create a simple card game and these cards have coloured shapes on them and such. Now I could do this using images but if possible id rather have unity generate each card as I think that would be faster, significantly reduce the size of my resources, not be as much prone to aliasing and offer flexibility and such.
Right now what I'm doing is creating a new Texture2D and creating boxes using a nested for loop to colour in each pixel ones by one. This will will prove very time consuming later when I want to make shapes like triangles and circles and such. It will also prove problematic when I need to have different coloured outlines for shapes and such.
I was wondering if there was some library functionality similar to Processings rect()
, elipse()
, triangle()
, stroke()
, fill()
, ETC...
I can't find functionality for this anywhere I look and it it's not possible I'd like someone to confirm for me, please! Thank you for reading and thanks in advance for help
Answer by streeetwalker · Feb 25, 2020 at 08:57 PM
Hunt around - you'll find stuff on the Unify Wiki: http://wiki.unity3d.com/index.php/TextureDrawLine
There you will find a circle as well.
there is also at least 1 library: https://forum.unity.com/threads/bitmap-drawing-api-for-textures.251557/
Thanks! Turns out that library is what I was looking for. I defiantly did hunt around for some hours even and couldn't find anything :/ Whatever. It's just a shame it doesn't have any anti-aliasing features but it does save me so much work so I'll use it
I think you can have unity apply anti-aliasing after the fact...