x


GUI Box always on top

alt text

This is my inventory menu screen. I've got a method which creates a box where the cursor is, while it's over a weapon image (this semi-transparent box with 'Berdysz 70'). The problem is that each item (so a button, weapon pic, some strings etc) and it's fluff box is generated via a for loop. Therefore every next item is being showed over each previous GUI element.

Is there a way to make a GUI elements - in my case this window, always on top?

more ▼

asked Aug 16, 2011 at 07:12 PM

4illeen gravatar image

4illeen
123 98 79 82

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Yes there is a way, you need to draw it after your for loop. The GUI system is an immediate system, what is drawn at last will show on top. But be careful, the input handling works the other way round: what is drawn first will receive the input. Without the code i can't give you any hints for your case.

more ▼

answered Aug 16, 2011 at 07:39 PM

Bunny83 gravatar image

Bunny83
83.1k 29 131 402

Another way is to use a GUI.Window. Windows are drawn above the normal gui stuff and have their own z-ordering system.

Aug 16, 2011 at 08:20 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
more ▼

answered Aug 16, 2011 at 07:42 PM

TowerOfBricks gravatar image

TowerOfBricks
3.9k 52 53 81

The thing is GUI.depth works for different classes only, not GUI elements inside one class - which is my case. and Since my showBox method takes parameters from inside of the for loop it's in, it's impossible to throw it out.

Aug 16, 2011 at 08:05 PM 4illeen

@4illeen: It's not impossible, you just need to store the condition / event / data and use it after the for loop. But as i said without the code it's useless to suggest a certain method / solution.

Aug 16, 2011 at 08:23 PM Bunny83
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5995
x251
x26

asked: Aug 16, 2011 at 07:12 PM

Seen: 3979 times

Last Updated: Aug 16, 2011 at 08:23 PM