1 (edited by zarcon 2017-03-29 10:29:26)

Topic: Tooltips always on top.

Hi!

I use "Online Maps" to put some 3D markers on the map. Sometimes i need to show tooltips (it may be one or more at one moment) for placed markers (1 tooltip for 1 marker of course).

The problem is that when i need to show some popup (not GUI), tooltips always show over popup, not behind it.

There is the code i use to my needs:

....
marker3D.OnDrawTooltip += onCustomMarkerDrawTooltip;
....

void onCustomMarkerDrawTooltip(OnlineMapsMarkerBase marker){

    OnlineMapsMarker3D tmpMarker = marker as OnlineMapsMarker3D;
    Vector2 screenPosition = OnlineMapsControlBase.instance.GetScreenPosition(tmpMarker.position);
    GUIContent tip = new GUIContent(tmpMarker.label);
    Vector2 size = tooltipStyle.CalcSize(tip);
    GUI.Label(new Rect(screenPosition.x - size.x / 2 - 5, Screen.height - screenPosition.y - size.y - 20, size.x + 10, size.y + 5), tmpMarker.label, tooltipStyle);

}

Maybe somebody knows how to put tooltips behind the objects? Thank you!

Post's attachments

Attachment icon example.png 62.87 kb, 231 downloads since 2017-03-29 

Re: Tooltips always on top.

Hello.

By default, tooltips are drawn using the old UI system, so it is located on top of the uGUI elements.
To work around this, draw the tooltips using uGUI.
Example:
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.