Initializing AR Using an IAP

By default, in the ARwayKit SDK, visitors can start navigation from IAPs only if they enter the map through the map list tab, select a map from the list, tap "Enter Map," and then tap the "Scan Access Point" button. This is because the map ID must first be selected so that the scanner can load the possible IAPs to the device.

To modify this functionality so map visitors can scan IAPs from the main button on the homepage, some additional code can be added. Keep in mind that this modification will only allow the selected map to be opened by the map visitor.

Steps:

  1. Get the Selected Map ID and Map Code:

    • From the Creator Portal, navigate to the Maps tab, select a map, and copy the Map ID and Map Code from the map details page.

  2. Modify the ARwayKit SDK:

    • Open the following file to begin making the modifications: Assets\ARWay\ViewerMode\2_Scripts\dashboard\MapListManager.cs.

    • Scroll down to the function named StartARSession() and modify it as follows:

public void StartARSession(bool isFromScanButton)
{
    SelectedMap map = new()
    {
        mapId = "2397c3394a5c475aa861e87d", // Replace with your own map id
        mapCode = "8184917418531", // Replace with your own map id
        isOwnMap = false,
        isVenueMap = false,
        isConnectedMap = false
    };
    EventManager<SelectedMap>.TriggerEvent("GetSelectedMapInfo", map);
    m_SceneLoader.LoadLevel("ARMapSession");
}

Now, with this change added, you can initialize AR using an IAP for the selected map. Keep in mind that you will only be able to open the selected map from the sample app.

Last updated