C# Tooltips through multiple windows

I am currently working on a script to auto-focus on the Gui window that is hovered over, the problem I am having is the window focus and tooltips. It seems as if the focus is shifted to the window, but the tooltips in the window will not show still until it is clicked on (manually focused).

Easy to test, just float over the windows, if the tooltip on the label doesnt show, click it and then it will… Any ideas on how to fix this issue?

using UnityEngine;
using System.Collections;

public class TestScript : MonoBehaviour {
	Rect charwindowRect = new Rect(10, 10, 200, 60);
	Rect inventoryRect = new Rect(10, 80, 200, 60);
	Rect tooltipRect = new Rect(10, 150, 200, 60);
	
	private string _tooltip;
	private int _tempfocus;
	
	void OnGUI() { 
		charwindowRect = GUILayout.Window(3, charwindowRect, CharWindow, "Char window");
		inventoryRect = GUILayout.Window(2, inventoryRect, InventoryWindow, "Inventory");
		tooltipRect = GUILayout.Window(1, tooltipRect, TooltipWindow, "Tooltips");
	}
	
	void CharWindow(int windowID) { 
		FocusWindow(charwindowRect, windowID);
		
		GUILayout.BeginHorizontal();
			GUI.Label(new Rect(25,20,265,20),  new GUIContent("char", "charwindow tooltip"));
		GUILayout.EndHorizontal();
		
		if (Event.current.type == EventType.Repaint) {
			_tooltip = GUI.tooltip; 
		}
	}
	
	void InventoryWindow ( int windowID) { 
		FocusWindow(inventoryRect, windowID);
		
		GUILayout.BeginHorizontal();
			GUI.Label(new Rect(25,20,265,20),  new GUIContent("inv", "inv window tooltip"));
		GUILayout.EndHorizontal();
		
		if (Event.current.type == EventType.Repaint) {
			_tooltip = GUI.tooltip; 
		}
	}
	
	void TooltipWindow ( int windowID) { 
		GUILayout.BeginHorizontal();
			GUI.Label(new Rect(25,20,265,20), _tooltip );
		GUILayout.EndHorizontal();
	}
	
	void FocusWindow(Rect thisRect, int windowID) { 
			if(thisRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
	    	{
				if(_tempfocus != windowID) {
				_tempfocus = windowID;
				GUI.FocusWindow(windowID);
			}
	    }
	}
}

Hey dju4ic,

You should try using GUI.BringWindowToFront, it may be your problem.

I hope this helps! -Gibson