1 (edited by soaringsimulator.com 2021-07-01 17:07:25)

Topic: How to place a Mark? Getting started using the API.

Hello,

I want to "Add Marker" to "OnlineMapsMarkerManager"
I need help starting to use the C# API.

Since it has its own namespace, it looks not conventional or does not understand how to make it work. I look all the video tutorials, the scripts examples but I do not get it.
FEEDBACK: In the Youtube video section, looks like missing a simple C# video on making a script component that feeds/uses the API code.

If you can provide one full working script "PlaceMark" example, let me started using the API.
I also did not understand how to feed "UIBubblePopup" CData[] data.


using UnityEngine;

public class PlaceMark : MonoBehaviour
{
    public Texture2D texture;


    void Start()
    {
        OnlineMapsMarkerManager.CreateItem(new Vector2(30.0f, -50.0f), texture, "Hellow Mark?");
    }
}

This script component was in the same "Map" game object. But is not connected to other components.
I also try


using UnityEngine;

public class PlaceMark : MonoBehaviour
{
    public Texture2D texture;


    void Start()
    {
        OnlineMapsMarkerManager map = GetComponent<OnlineMapsMarkerManager>();
        map.CreateItem(new Vector2(30.0f, -50.0f), texture, "Hellow Mark?");
    }
}

Do I need to put using... or after PlaceMark : MonoBehaviour, ... as a child?

LINKS
https://forum.infinity-code.com/viewtopic.php?id=1432

Re: How to place a Mark? Getting started using the API.

Hello.

The scripting video is useless here because you create scripts for Online Maps in the same way as any other MonoBehaviours.
There are many Unity basics tutorials on the internet in text or video formats.

We have an atlas of examples of how to use Online Maps API, which contains about 90 examples for different use cases.
https://infinity-code.com/atlas/online- … tml#Marker

Your first script looks correct and should work.
You can check for the presence of a marker using the inspector.
This has no references to other components because you are using a static method that works through a singleton (a reference to the active instance of the component).
This is more convenient when you have one instance of the map in the scene.

In the second script, you need to use Create method instead of CreateItem.

Unfortunately I didn't understand your problem with UIBubblePopup.
Please ask this question in more detail.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.

3 (edited by soaringsimulator.com 2021-07-01 19:11:02)

Re: How to place a Mark? Getting started using the API.

Thank you for your time and useful answer. I'm trying and I think I get it.

I'm a good C# biginer user and with basic C# scripting and as an example was able to code a complex Digital Airfoil Designer: youtube AcGxMhnTe0I
Last week I start this new Android project and implement several assets very fast and running including Online Maps.
But my learning curve went steep when I hit Online Maps namespaces.
In my case, looking at scripts unraped into a namespace Online Maps didn't know how to approach to it. In particular, was difficult to find conventional more example without namespace. The problem is I do not know how to use namespaces. I understand that is better to use them (for jumping to (youtube LtQs5FzdQ2k) "Intermediate Scripting" and youtube BHXtVGKr-sU "should use it"). So I did not understand how to integrate a new namespace into my workflow. And the examples look more intermediate and expert.

Side Note: Using RAD, Unreal and Unity looks like a big gap between Documentation and API like if missing something in the middle. Code examples. Your list is great!

As a user, I'm more video tutorial example. So I suggest a video tutorial at the end of your Youtube list series where you show the page with examples and a beginner scripting introducing also the API. For example, In the atlas of examples a first script places a mark on the map. A simple code like my second script.
And a second one making an array of marks (do I need to use CData[] data?). That probably can make takes off the C# beginner like me and smoothly transition going up with the other great examples.

Awesome work and a fantastic asset I'm using to create my Soaring Simulator: https://forum.unity.com/threads/wip-soa … or.411299/

Alan

Re: How to place a Mark? Getting started using the API.

Online Maps scripts are located in the root namespace.
Here I explained in detail why:
https://forum.infinity-code.com/viewtop … 7490#p7490

Examples are in InfinityCode.OnlineMapsDemos and InfinityCode.OnlineMapsExamples namespaces.

You only need to use CData if you want to display complex markers like in UIBubblePopup example scene.

Kind Regards,
Infinity Code Team.

uContext is Editor PowerPack (more than 50 tools) that take your workflow in Unity Editor to a next level, simplifies working with content, adds new features, corrects and improves the editor’s built-in behaviors. Click here to download uContext Basic for free.