Hey, i’m quite new to Unity GUI so any help will be appreciated.
I have GUI textures for my health bar for example. And this is the code i’ve got.
if (curHp > 0)
{
GUI.DrawTexture(Rect(5, 5, hpBarLength, 20), HpBarTexture);
}
This works fine for me and no matter what i change the resolution to, it stays the same.
But i also have GUI Text to show the amount of health for example, but this i can’t seem to get it like the Rect like above.
To get the GUIText i created it from the “GameObject”, “Create Other”, i mean, i ave it working fine it reacts with my scripts for example. But then when the resolution changes it doesn’t stay in the same place.
I’m sure this is to do with the fact that in the “inspector” i can only seem to manipulate the positions with the “Pixel Offset” which means it obviously changes on resolution due to the pixel changes. How would i go about making it so it’s like the GUI.DrawTexture and is the same for all resolutions.
I hope this makes sense.
Would i have to try attaching scripts to the GUITexts in the Hierarchy, or would coding the texts instead of using the GUITexts work better?
I’m not too sure ^^
Also on this note, it would look a lot better if i could have a GUI box behind the health bars for example, is there a specific way to layer this or different ways to do it?
Thanks all.