Still an issue with click-through on 2.5.1?

I updated to 2.5.1 and there still seems to be an issue with click through.

Please correct me if I’m wrong.

I’m running U2.5.1 on Windows Vista 64Bit.

If I run the code below, I get a string of buttons on the screen. The button at guidepth -1000 is on top of -500, on top of -100, etc… with +1000 on the bottom. If I click on the right half of -1000 button, “-1000” is printed. However, if I click on the left half of the button, where it overlaps -500, and click, I get “-500” printed, even though the -1000 button is on top.

Regards,

Jason

function OnGUI{
GUI.depth = 1000;
	if (GUI.Button  (Rect(400,400,100,100),"1000"))
		print("1000");
	GUI.depth = 500;
	if (GUI.Button  (Rect(450,400,100,100),"500"))
		print("500");
	GUI.depth = 100;
	if (GUI.Button  (Rect(500,400,100,100),"100"))
		print("100");
	GUI.depth = 10;
	if (GUI.Button  (Rect(550,400,100,100),"10"))
		print("10");
	GUI.depth = 0;
	if (GUI.Button  (Rect(600,400,100,100),"0"))
		print("0");
	GUI.depth = -10;
	if (GUI.Button  (Rect(650,400,100,100),"-10"))
		print("-10");
	GUI.depth = -100;
	if (GUI.Button  (Rect(700,400,100,100),"-100"))
		print("-100");
	GUI.depth = -500;
	if (GUI.Button  (Rect(750,400,100,100),"-500"))
		print("-500");
	GUI.depth = -1000;
	if (GUI.Button  (Rect(800,400,100,100),"-1000"))
		print("-1000");
}

Have you submitted this example as a project with the bug reporter?

Also,

If I reverse the order of the lines in the code, i.e the first line is -1000 depth and on down, it appears that the last line of code is on top (depth order) and the first is on the bottom, same as the original code, meaning that the engine is not taking depth into account, just execution order. The button click-through issue is still present either way.

I am bug reporting this now, just wanted to see if anyone else is experiencing the same issues?

Jason

It uses depth but only if it is used as described in the docs.

Depth is affecting only multiple distinct OnGUI components.
Within a single ongui, the order of execution defines the depth

@dreamora:
Thank you, that was a big help. Moving each line to a separate script makes them work as intended, including click through to the button below, it no longer happens.

@all :
[Moved to a separate thread]