Character Battle Menu
Hi everyone i have been looking on the internet for a while now i need a little help, i am trying to make a menu on my character that says attack,skill,Item,Run
I Have Used onGUI() and made a button with
public Texture2D icon;
if (GUI.Button(new Rect(50, 50, 100, 50), icon))
{
}
my Hud object lies on x=-2 and y=-1.74 Problem i have is even if i do this
if (GUI.Button(new Rect(-2,-1.74f, 100, 50), icon))
{
}
it does not go into my hud object it goes to the top left hand corner of my screen can someone give me suggestions on how i can make a menu for my turned based battle so i can choose attack or item
or if someone can tell me how to make the button go where my hud is and not move around
if i can figure this out i will make a tutorial because i cant seem to find one that shows how to make a character options screen pop up like attack,magic
Did you create your hud object in the editor? If so: did you get the (-2, 1.74) position from the recttransform section in the editor or did you print out its position at runtime? The editor shows the localposition relative to its parent objects and its alignment. If you create a gui button at runtime you set its position non-relative to alignment (i think). So you should get the hud object's position at runtime and use that as a position to create your rect.