- Home /
how to make global labels in front and GUI.BringWindowToBack(ID);
void OnGUI() {
// 2 labels for screen X/Y detection for GUI elements
GUI.Label(new Rect(0,0,100,20),Event.current.mousePosition.x.ToString());
GUI.Label(new Rect(0,20,100,20),Event.current.mousePosition.y.ToString());
// label for screen Y detection for input mouse position
GUI.Label(new Rect(0,60,100,20),Input.mousePosition.y.ToString());
WindowInventory = GUI.Window(InventoryID, WindowInventory, InventoryF, "Inventory", "Box");
GUI.BringWindowToBack(1);
}
private void InventoryF (int id) {
GUI.DragWindow(new Rect(0,0,WindowInventory.width,20));
}
now this inventory window will stay in front of Global labels how do I bring that labels in front without giving another window?
why because I'm using global buttons to drag and drop in Equip and it's annoying if they are in back while they should be in front
from window to window
Answer by Bunny83 · Jan 27, 2013 at 03:25 AM
Windows are always drawn after the usual GUI stuff. So what you can do is put the other things also in a window then you can put one in front of another.
Another solution is to not use a window at all and draw your inventory before your "global labels". In this case, it you need the dragging functionality you have to implement this yourself, but it isn't too hard ;)
yeah thought I'd need to make a window through whole screen
well I've already have the drag and drop buttons and verifying if it's on correct box in equip window when mouse released
but I thought there's an easier solution
thanks anyway
cannot do with creating a new new window as items in world can't see if they have been pressed - void On$$anonymous$$ouseDown ()
OH crap if I make window through whole screen items can't see if I've mouse pressed them
even depth doesn't work I have 3 depths 0,1,2 (3 scripts) and witch ever window I click that one is in front
but if do it without all windows how am I going to tell witch one is in front of who?
Your answer
Follow this Question
Related Questions
How do you add graphics and features to a GUI Window? 1 Answer
dll cross platform? 2 Answers
java to c# 2 Answers
Error CS0016 in Unity? 0 Answers