1 (edited by mschakulat 2016-09-12 15:38:29)

Topic: How to get the instance of the marker from location service

Hi..
How can i get the instance of the current marker fro the location service? I added my 3D Prefab und it is shown on the map. I tried to get the current instance by "OnlineMapsLocationService.marker3DPrefab" but that seems only to be the prefab itself and not the current instance. The only way for me to get the instance until now was to use the Find method of the GameObject:

GameObject.Find ("MyMarker(Clone)");

Is there a better way to do that? And where is the best (earliest) place to get the instance (maybe "OnLocationInited")?

Besides that, if i get the instance as shown above i have a strange behavior i don't understand.
Sometimes when get the marker like above, the marker gets inactive. I tried it several times. It is only this one line of code which causes this.

Maybe you can give me a hint how to access the marker and maybe you have an idea why it becomes inactive sometimes.

Re: How to get the instance of the marker from location service

Hello.

OnlineMapsLocationService.marker
http://infinity-code.com/doxygen/online … 2f91a82a92

Yes, use OnLocationInited.

The marker is inactive when it is outside the map.
Check the location that you specified in the emulator. X - longitude, Y - latitude.

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 get the instance of the marker from location service

Thank you, Alex. OnlineMapsLocationService.marker works and I get the OnlineMapsMarkerBase object. But I don't know how to access Components I added to the marker, like animations, as I will get no GameObject but a OnlineMapsMarkerBase object. Can you also help me with that problem?

Re: How to get the instance of the marker from location service

Something like:

OnlineMapsMarker3D marker3D = OnlineMapsLocationService.marker as OnlineMapsMarker3D;
MyScript script = marker3D.instance.GetComponent<MyScript>();
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 get the instance of the marker from location service

Thank you very much Alex.
Awesome support here!