I have a menu that is essentially a background image and 4 buttons using GUITextures. What I’m trying to do is get the buttons into one draw call.
My idea is to use the PackTextures() function to create an atlas, but I need help! I’m unfamiliar with non-runtime code and was wondering if someone could give me the basics of how I’d go about replacing my buttons into one atlas and getting them back into the scene?
I’m thinking something along the lines of…
- Create temporary GameObject
- Attach the button textures as an array
- Run PackTextures() function on array to create atlas
- Delete/disable the temp GameObject
- Find the resulting atlas [where?] and attach it to all 4 buttons
- Get the rect coordinates [how?]
- Specify the rect coordinates to each GUITexture component so it knows which area of atlas to use [also how?]