Send an event
In order to send an event to unity you can call the sendEvent method:
FnoMapManager.sendEvent("zoomIn", {zoomValue : 0.5});
sendEvent method takes these following parameters:
Name | Type | Description |
---|---|---|
EventName | string | the name of the event |
Data | object | parameters of your called event. ex: {zoomValue: 0.1} |
Callback | Function | a callback function for unity return (optional) |
All events are located in Events to unity section
Example
Enable the event "setMouseListener", allow to trigger the event "onClick" to be fired when map is loaded :
x
const fnoToken = "<YOUR-FNO-TOKEN>"; // provide from backoffice
const fnoMapId = "<MAP-ID>" // id of the map to load
let FnoMapManager;
window.addEventListener("load", function(){
FnoMapManager = window.FnoMapManager;
FnoMapManager.initViewerMode(fnoToken)
FnoMapManager.loadMap(idMap, '3dMapContainer', function(){
// enable onClick event in 3d map
FnoMapManager.sendEvent("setMouseListener", {state : true});
})
});