Hello. So I’ve learned quite a bit over the small amount of time I’ve been using Unity and I rather enjoy it quite a bit compared to other options out there. So now I want to try and make a MiniMap and WorldMap for my game project. However, I am at a stand still because I’m not sure where to go and how to go about it. I’ve read and watched several tutorials out there, most being with 2nd cameras. But I had several problems with this.
The first being that I don’t like it as just a second box camera in the top right/left of my screen. And two, I can’t figure out how to get the water looking good in that anyways with reflections.
I’m also using the new test phase 4.6 to try out the new GUI options and found I like the direction they are going. But I still can’t figure out a good way to do this. My most recent attempt involved a image on screen that represented a border, a second one that filled the border which represented a mask. But then I tried to use a camera to be masked with an orthographic view and of course that didn’t work. So at this point, I was hoping someone could shove me in the right direction. I don’t want to buy a asset, I’d like to learn as I go and build from the ground up.
Hmmm, I still haven’t figured this out. In fact I stepped away temporarily just to work on another UI feature to give my brain a moment to think. Now I’m working on the life and mana bars and already I’ve come across more problems. I couldn’t figure out how to adjust the height of the new images in inspector mode. Finally I figured that I had to use sizeDelta to reach it’s height. I then made 3 variables for both mana and life involving minLife, maxLife, and LifePerc. I set lifePerc to minLife/maxLife and same to mana. Then changed the scaling to the texture by doing
var isLIFE = false;
var isMANA = false;
var MinLife = 100;
var MaxLife = 100;
var MinMana = 100;
var MaxMana = 100;
var LifePerc = MinLife/MaxLife;
var ManaPerc = MinMana/MaxMana;
var HealthImage : UI.Image;
var ManaImage : UI.Image;
function Start () {
}
function Update () {
if(isLIFE){
LifePerc = MinLife/MaxLife;
//same happens for the scaling with the texture
//HealthImage.transform.localScale.y = 160 * LifePerc;
HealthImage.rectTransform.sizeDelta = new Vector2( 160, 160 * LifePerc);
}
if(isMANA){
ManaPerc = MinMana/MaxMana;
}
}
Note that the variable/s isLIFE and isMANA are checked in the inspector. What ends up happening is unless min and max life are the same the % equals 1 for some unknown reason and the height always equals 0 or 160…