Topic: How to show tooltip with custom data for 3D Markers

Hello everyone

I am a new-bee so please excuse if this is a stupid question.

I want to show tooltip on my 3D markers. I have used the Marker3D_Example.cs script to show the marker. I added custom data to the markers on the lines of MarkerCustomDataExample.cs:

OnlineMapsControlBase3D control = OnlineMapsControlBase3D.instance;

//lat, lng are float values.
OnlineMapsMarker3D marker1 = control.AddMarker3D(new Vector2(lng, lat), markerPrefab);

//city, latitutude, longitude are string values.
OnlineMapsXML xml1 = new OnlineMapsXML("MarkerData");
xml1.Create("ID", city+" "+latitude + " " + longitude);
xml1.Create ("Coordinates", latitude + " " + longitude);

marker1.customData = xml1;

But this doesn't show tooltip.

Can anyone please help me with this?

Thanks
Abhishek

Re: How to show tooltip with custom data for 3D Markers

I managed to add the tooltip as follows

OnlineMapsMarker3D marker1 = control.AddMarker3D(new Vector2(lng, lat), markerPrefab);
marker1.label = "This is a label";

Re: How to show tooltip with custom data for 3D Markers

Hello.

You can store any data in customData, but that does not mean that Online Maps will use this.
Online Maps does not know what kind of data it is.
You should read this and if you want to show it on the tooltip with marker.label, or by any other way, for example using the custom tooltip drawer:
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.

Re: How to show tooltip with custom data for 3D Markers

Thanks very much for reply.

I used uGUICustomTooltipForAllMarkersExample but it is asking for Canvas for container. Can you tell me what canvas should I give it?

Re: How to show tooltip with custom data for 3D Markers

https://docs.unity3d.com/Manual/UICanvas.html

It must be a root canvas or any child element.

Kind Regards,
Infinity Code Team.

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

Re: How to show tooltip with custom data for 3D Markers

Hi

I created a Canvas element (image attached) and added that to the script but I got this error:

NullReferenceException: Object reference not set to an instance of an object
InfinityCode.OnlineMapsExamples.uGUICustomTooltipExample.OnUpdateLate () (at Assets/Infinity Code/Online maps/Examples (API usage)/uGUI/uGUICustomTooltipExample.cs:46)
OnlineMaps.Update () (at Assets/Infinity Code/Online maps/Scripts/OnlineMaps.cs:2210)


on this line in the script:
(tooltip.transform as RectTransform).SetParent(container.transform);

I then tried adding a child Canvas element to the parent Canvas element and adding that to the script but again same error.

What am I missing?

Thanks

Post's attachments

Attachment icon Screen Shot 2018-02-21 at 11.58.25 PM.png 781.92 kb, 74 downloads since 2018-02-21 

Re: How to show tooltip with custom data for 3D Markers

Hello.

There can be two reasons for this error:
1. You did not specify a container.
Solution: specify container Canvas.
2. (Most likely) Your tooltipPrefab is not a UI element.
Solution: use UI element for tooltipPrefab.

Kind Regards,
Infinity Code Team.

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

Re: How to show tooltip with custom data for 3D Markers

You were right. My Tooltip prefab wasn't a UI element smile

It works now. Thanks a lot.