- Home /
Developing a Dynamic GUI
Hello community, I was wondering if there was any way to develop a dynamic GUI (one that alter's it's shape, tweens GUI elements to be drawn on the screen, etc.) in Unity because I am tired of the static-stay in one place-GUI. You know how Mac OS X has all of those fancy visuals in their GUI, is there anyway I could do something like that in Unity? Thanks! :)
Answer by dannyskim · Feb 25, 2012 at 08:29 PM
Well, if you're talking built in functionality, then no, there's not really anything that Unity has provided to you for making complex and dynamic menu systems. This is why the top paid solutions on the Asset Store for Unity have been GUI solutions, because a lack of a decent integrated system.
With that said, if you want to go the lowest cost route possible, you can create your menu system utilizing GUITextures. GUITextures are drawn on top of everything, and can be tweened by referencing their gameObjects. A great all around animation system would be iTween, found at the following link:
http://itween.pixelplacement.com/index.php
What you can do, is create an empty Game Object, and then set all your GUITextures how you would want them placed in one menu group, and then set them as children to that empty Game Object, in essence making this function as a panel. It's important for easy placement and movement of these panels that you set your empty Game Object at Vector3.zero to make it simpler to work with.
So to animate the panel, you could simply reference the Game Object in iTween to move all the GUITexures off of scene. To animate individual GUITextures, you could reference the Game Object by GUITexture.gameObject when passing it into iTween to animate localScale, position, etc.
It is important to note that if you choose to go this route, you cannot Atlas your GUI Textures causing a dramatic increase in package size due to the compartmentalized nature of doing things this way. Ultimately if you're serious about your development, I would recommend nGUI as your GUI solution to make your life a whole lot easier:
http://forum.unity3d.com/threads/114833-NGUI-(Next-Gen-UI)-demo-amp-final-feedback-request