Topic: Markers from .prefab on 2D map

Hello,

Currently, I am working with a 2D map (UI IMAGE MAP) and I need to add markers based on .prefabs objects, how can I do that?

Or how can I create markers using texts instead of textures?, I want to use texts because I have a font file with all ours icons (similar to  font awesome toolkit), and so avoid create a image file for each icon with its differents colors and sizes.

regards

Re: Markers from .prefab on 2D map

Hello.

Unfortunately, there is no built-in way to use 2d markers based on prefab.
But you can work around this by making your own marker system.
Example:
http://infinity-code.com/atlas/online-m … ample.html

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

In that example "markerContainer" would be my UI IMAGE MAP? or what is it exactly?

thanks.

Re: Markers from .prefab on 2D map

Canvas or any child GameObject, which will be a container for the markers.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

This is exactly what I need but I can't get my markers to be placed correctly. They are always located really really far from my canvas. I use the uGUI Image implementation of OnlineMaps. The Custom Marker Engine Example component is on the same GameObject as the OnlineMaps component. Any idea what the problem here is? The error is clearly happening when calling RectTransformUtility.ScreenPointToLocalPointInRectangle.

Cheers,

Paul

Post's attachments

Attachment icon Screen Shot 2016-05-11 at 9.39.50 AM.png 108.51 kb, 29 downloads since 2016-05-11 

Re: Markers from .prefab on 2D map

Hello.

Unfortunately, I have no idea why this is happening.
If you send your scene to support (support@infinity-code.com), we will check and fix it.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

Here's a repro project:
Link removed.
Cheers,
Paul

Re: Markers from .prefab on 2D map

Hello.

The problem was in Screen Space - Camera.
The latest version of the example is attached.

P.S. Please do not attach the project with Online Maps scripts here. I'll remove it.
If you want to send us a complete project, write to support (support@infinity-code.com).

Post's attachments

Attachment icon uGUICustomMarkerEngineExample.cs 6.07 kb, 70 downloads since 2016-05-11 

Attachment icon uGUICustomMarkerExample.cs 641 b, 45 downloads since 2016-05-11 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

Hey there Alex,

Sorry for having attached a full project... didn't think first. Won't do it again.

Thanks for the rapid response! You guys are awesome.

However, the new code isn't compiling correctly more than likely because you're on a dev branch with extra stuff in OnlineMaps. Here are the errors that are coming up:

Assets/Infinity Code/Online maps/Examples (API usage)/uGUI/uGUICustomMarkerEngineExample.cs(109,17): error CS1061: Type `OnlineMaps' does not contain a definition for `projection' and no extension method `projection' of type `OnlineMaps' could be found (are you missing a using directive or an assembly reference?)

Cheers,

Paul

Re: Markers from .prefab on 2D map

Sorry, I do not see what you are using Online Maps v2.3.

Please update Online Maps through the built-in update to the latest beta version.
Component / Infinity Code / Online Maps / Check Updates
or
Online Maps Inspector / Help / Check Updates.

Additionally in Online Maps v2.4 we highly optimized code.
Your project will work faster and use less memory.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

First problem:
Can't find the Check Updates method anywhere so I had to create an Editor method that calls it manually hehe Was this fixed in latest version?

When I enter the Invoice Number (just numbers) I'm getting:

a name did not start with a legal character 32 ( )  Line 4, position 54.
UnityEngine.Debug:Log(Object)
OnlineMapsXML:Load(String) (at Assets/Infinity Code/Online maps/Scripts/XML/OnlineMapsXML.cs:596)
OnlineMapsUpdater:GetUpdateList(String) (at Assets/Infinity Code/Online maps/Scripts/Editor/OnlineMapsUpdater.cs:180)
OnlineMapsUpdater:CheckNewVersions() (at Assets/Infinity Code/Online maps/Scripts/Editor/OnlineMapsUpdater.cs:51)
OnlineMapsUpdater:OnGUI() (at Assets/Infinity Code/Online maps/Scripts/Editor/OnlineMapsUpdater.cs:227)
UnityEditor.DockArea:OnGUI()

When I enter the same number but with two letters in caps in front of it I'm getting a message saying it's an invalid invoice.

Suggestions?

Cheers

Re: Markers from .prefab on 2D map

How to open the built-in update system:
img1 - The usual way (img1). Some users do not have this item. Unfortunately, I do not know why. So in Online Maps v2.4.0.11+ we moved it into GameObject (img3).
img2 - Alternative way.

About invoice number:
Thank you for reporting this.
The problem was an invalid character in the description of the last update.
The problem is fixed. You can use it.

Post's attachments

Attachment icon img1.png 27.57 kb, 30 downloads since 2016-05-12 

Attachment icon img2.png 32.12 kb, 29 downloads since 2016-05-12 

Attachment icon img3.png 62.05 kb, 29 downloads since 2016-05-12 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

Thank you for the update. I've got everything working now.
Do you think more effort should be put into making the custom prefab engine more space in your engine? For example, I definitely need to use this engine for making the map nice and interactive. I would like to use this engine and also make use of methods like GetCenterPointAndZoom but now that I'm not using my custom markers I can't use it. I can inherit from OnlineMapsMarker but then the notion of Texture is inherent in that class. Do you think an extra class that comes somewhere between OnlineMapsMarkerBase and OnlineMapsMarker would be handy in order to make the custom engine usable out of the box? I will more than likely have to make modifications to your code in order for stuff to work on our side. Is that ok?
Cheers,
Paul

Re: Markers from .prefab on 2D map

Also, you should think of namespacing your code base.

Re: Markers from .prefab on 2D map

And you should think about making OnlineMapsMarkerBase, OnlineMapsMarker, and OnlineMapsMarker3D interfaces so that MonoBehaviours can implement them manually.

Re: Markers from .prefab on 2D map

OH! But this exists: GetCenterPointAndZoom!

Sorry for the monologue wink

Re: Markers from .prefab on 2D map

Since I've updated, I'm getting this error when calling Google Directions API:

Text node cannot appear in this state.  Line 1, position 1.
UnityEngine.Debug:Log(Object)
OnlineMapsXML:Load(String) (at Assets/Infinity Code/Online maps/Scripts/XML/OnlineMapsXML.cs:678)
OnlineMapsDirectionStep:TryParse(String) (at Assets/Infinity Code/Online maps/Scripts/Plugins/OnlineMapsDirectionStep.cs:124)
MapView:OnFindDirectionComplete(String) (at Assets/Scripts/SelectScene/MapView.cs:218)
OnlineMapsGoogleAPIQuery:CheckComplete() (at Assets/Infinity Code/Online maps/Scripts/GoogleAPI/OnlineMapsGoogleAPIQuery.cs:85)
OnlineMaps:CheckGoogleAPIQuery() (at Assets/Infinity Code/Online maps/Scripts/OnlineMaps.cs:927)
OnlineMaps:Update() (at Assets/Infinity Code/Online maps/Scripts/OnlineMaps.cs:1829)

Re: Markers from .prefab on 2D map

I just checked it.
Everything works well.

Please show your code (how you use it).
I will check it.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

OnlineMapsGoogleAPIQuery query = OnlineMapsFindDirectionAdvanced.Find(_startExperienceDestinationMapMarker.position, _yourLocationMapMarker.position, OnlineMapsFindDirectionMode.walking);

Just realized I'm getting a 400 Bad Request. What do you think this can be caused by? Am I supposed to be setting an API key?

Re: Markers from .prefab on 2D map

We found and fixed the problem.
The new version is already available through the built-in update system.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Markers from .prefab on 2D map

Everything's working as needed now smile thanks so much for the amazing support