Hello everyone.
I want to have a 2D Face Generator that will generate a face from a couple of different textures.
Something like: select a random face texture, then select a random hair texture, then select a random beard texture etc.
And eventually display it with GUI.DrawTexture.
My problem is not the code.
I’m worried about performance if I use about 5 GUI.DrawTexture just to draw the face.
Is there a way I can select my random texture and then combine them before display? (so I can use only one GUI.DrawTexture)
Thanks!
It's never gonna be 25 (not in the near future anyways), so no need to over stresses it. It's just that I already have like 700+ draw calls while in game and I want to try to save as many as possible. I'm actually not sure if 700 is a lot, but I think it is :P
– dorpeleg700 is a bunch of draw calls but the proof is always running the app on the target platform. You may want to take a look at a more general solution for your game...a texture atlas comes to mind. A texture atlas would reduce your face drawing to a single draw call and could be used to help batch other draw calls.
– robertbuThe point is, say you test with 5 textures, and think "hmmm...it sort of seems maybe laggy; if I spin it this way feels sluggish, or am I imagining it... ." There's a good chance that if you test with 25 noise textures, if will run perfectly fine. Then you'll have zero nagging doubts over whether you should have used only 4, or whether you can afford an extra scar texture. Likewise, if 25 runs like molasses, you'll know for sure you weren't imagining that slowdown with 5, and every texture does count.
– Owen-Reynolds@robertbu "texture atlas" as in one texture to hold the pictures and then somehow only show the one you want? I'm thinking about doing that regardless, I should help. But back to the topic, you mind showing me some example code of how to use the GetPixels()/GetPixels32() and SetPixels()/SetPixels32()? Just in case i'll decide to use it :) @Owen Reynolds "if I spin it this way feels sluggish" that's how I feel about it... so I'm just checking for other options.
– dorpelegKeep in mind I'm talking about 2D GUI If I put all my faces and hairs and beard and whatever on one texture, won't it still be 5 draw calls? because I will still need to use DrawTexture 5 times only with a different coordinates.
– dorpeleg