Unity Package

Custom POIs

General 

A Custom POI is in general the same as a normal Points Of Interest but it allows you to create your own points in the world. Additionally, it can hold your own data in a "payload". There are two different kinds of custom Points of Interest.

Each Custom POI consists of a name, its coordinates, and an optional payload.

POIs uploaded by the project owner in the back-end

Full instructions on how to create custom POIs in the COALA back-end can be found here.

User generated POIs

When allowing users to generate custom POIs, you can use the Tag Suggestions method to obtain and present eligible Names for the new POIs to the user.

To generate a custom POI and send it to COALA, you can orientate yourself on the following example script: 

{


public void OnError (string message)

{

Thoughtfish.Coala.Core.Network.Custom.POI.OnAnswerReceived -= OnSuccess;

Thoughtfish.Coala.Core.Network.Custom.POI.OnError -= OnError;

//log as an example reaction

Debug.LogError( message );

}


public void OnSuccess(string message, GPSCoordinates coordinates, string payload)

{

Thoughtfish.Coala.Core.Network.Custom.POI.OnAnswerReceived -= OnSuccess;

Thoughtfish.Coala.Core.Network.Custom.POI.OnError -= OnError;

//log as an example reaction

Debug.Log( message );

}

// just as an example in this start method

public void Start()

{

Thoughtfish.Coala.Core.Network.Custom.POI.OnAnswerReceived += OnSuccess;

Thoughtfish.Coala.Core.Network.Custom.POI.OnError += OnError;

GPSCoordinates coordinates = Thoughtfish.Coala.GPS.Provider.GPSPosition;

Thoughtfish.Coala.Core.Network.Custom.POI.Add("default", coordinates.lon, coordinates.lat, " {\"username\":\"example\",\"level\":3,\"avatarData\" {\"hatAssetIndex\":0,\"hairAssetIndex\":7,\"faceAssetIndex\":7,\"hairColorIndex\":4}}");

}

}

It is advised to block the UI button that triggers this and gives feedback for the result. For this we provide the shown events. Please note that a user can't upload another custom POI until their last custom POI request has gone through, with or without an error.

Working with Custom POIs

To render custom POIs or use their Payload for other tasks, you have to implement your own "ICustomPoiGenerationLogic", or use the default logic: 

In the default spawn ScriptableObject you can assing custom POI names to a visual representation:

Your implementation or the instance of your default version needs to be added to the "CoalaConfig" used in your project: