So, I created a basic little doo-dad for my Health/Mana/Experience/Level/Player portrait. (Yeah, it’s to same as all the other mmo’s, sue me D: ) lol. Anyhow, This is just for learning experience.
Curious as to how I would get a Health and Mana bar to fit into this, I keep hearing about textures… but, hoenstly… Can’t I just use Renderer.Material = Color.blue or something?
Anyhow, I have no idea what I’m doing on the GUI aspect, I’m completely passed making interfaces with boxes and buttons. Just want to get this done so I have something that actually looks cool on my project, and perhaps start other GUI projects based on what I’ve learned
How are those shapes being implemented right now? There are many ways to implement bars like that so what might help is if you post a few images showing how your design looks.
This is how my design looks, I know nothing about unity GUI… I’m just tossing this up in the top left, I would guess with a DrawTexture? I wanted the bars to go through that. Top being health, Mana being in the middle, and Experience being at the bottom.
You just got to setup your GUISkins, having styles specified so they reference the images on your disk.
Then you got to use GUI.Box-es iniside the OnGUI() method call to draw your stuff.
For instance, for the background (overal) image this would be:
public GUISkin YourSkin;
private Rect _rect = new Rect(10, 10, 250, 100);
void OnGUI() {
GUI.skin = YourSkin;
GUI.Box (rect, "", "your_style"); // "" for no content, "your_style" is the style name in your skin
}
The above code should be the part of your MonoBehaviour script.
You should attach your skin file to the YourSkin variable from UnityEditor.
In your skin file you should create a custom style called “your_style”. Or you could modify one of the default styles - “box” for example - and not supply any style name. GUI.Box would then use the “box” style, GUI.Label would use the “label” style etc.