skip to Main Content

Scripting Support (C#)

The asset includes some useful public methods and properties to customize via scripting.

First, you need to get a reference to the CompassPro script, using:

using CompassNavigatorPro;
CompassPro compass = CompassPro.instance;

Once you have a reference to the compass instance, you can access its properties and methods. Example: compass.verticalPosition = 0.2f;


  • cameraMain: let you set the camera at runtime (useful if you change active camera).

  • degrees: returns the current heading degrees of the compass.

  • style: choose between the available compass bar graphic styles.

  • visibleDistance: POIs beyond this distance won’t be visible in the compass bar.

  • nearDistance: distance threshold where the icons will start to grow.

  • visitedDistance: distance at which the POI is considered visited. The radius of the POI is also used with this property.

  • gizmoScale: scaling factor applied to in-scene icons.

  • alpha: the transparency of the compass bar.

  • autoHide: will hide the compass if no POIs are below visible distance. Compass will revert to visible when first POI gets nearer than visible distance.

  • fadeDuration: duration of the fade in/out effect.

  • verticalPosition: value (0 = bottom..1 = top) for the vertical position in the screen.

  • width: value (0..1, 1 = screen width) for the width of the compass bar.

  • endsCapWidth: size in pixels for the ending parts of the compass bar where you don’t want to show icons. This property must be set for each compass bar style.

  • minIconSize andmaxIconSize: scaling factors for the icons in the compass bar.

  • textVerticalPosition,textScale: controls the position and size of the text.

  • textRevealDuration,textRevealLetterDelay,textDuration, textFadeOutDuration: controls the animation cycle for the text (reveal, duration of the text on the screen, and finally duration for the fade out).

  • titleVerticalPosition,titleScale: controls the position and size of the POI’s title shown over the center of the compass bar.

  • showDistance: will show the distance in meters to the centered POI in the compass bar.

  • showCardinalPoints: will show N, W, S, E in the compass bar.

  • use3Ddistance: if enabled, the Y coordinate will be ignored when computing distance for icon scale. This property has no effect on the distance shown in the title (if showDistance is true).

  • sameAltitudeThreshold: the difference in altitude between the POI and the main camera to show “Above” or “Below” as part of the title.

  • visitedDefaultAudioClip: an optional audio clip to be played the first time a POI is visited. Note that you can specify a different audio clip in the POI script itself.

Mini-Map related properties

  • showMiniMap: shows/hides the mini-map.

  • miniMapZoomLevel: gets or sets the current mini-map zoom level (0-1) based on the min/max range defined in the Mini-Map properties.

  • miniMapZoomState: gets or sets the current mini-map zoom state (false = normal size, true = full-screen size)

  • miniMapFullScreenSize: the % of screen the mini-map fills when in full-screen mode. A value of 1 will make the mini-map fill the full screen.

  • miniMap*: public properties shown in the inspector are also accessible through scripting.


  • Refresh: forces a refresh of compass-bar and mini-map icons.

  • FadeIn(duration): shows the compass bar with a smooth fade in effect.

  • FadeOut(duration): hides the compass bar with a smooth fade out effect.

  • POIFocus(CompassProPOI poi): makes a POI the principal POI. The icon will always be visible in the compass bar and a gizmo will be shown in the scene during playmode.

  • POIBlur(): cancels POIFocus effect.

  • POIShowBeacon(CompassProPOI poi, duration, horizontalScale, intensity, color): activates a light beacon oriented to the sky which lights for a few seconds making easy to locate the distant POI in the scene from the player perspective.

  • POIShowBeacon(duration): activates a light beacon for all non-visited POIs oriented to the sky which lights for a few seconds making easy to locate the distant POIs in the scene from the player perspective.

  • ShowAnimatedText(text): triggers text appearing animation with a custom text.

  • MiniMapZoomIn / MiniMapZoomOut: zooms in/out the minimap with optional speed parameter.

  • UpdateFogOfWar(): resets and render the fog of war volumes in the mini-map.

  • ResetFogOfWar(alpha): fills entire scene with fog of war with given opacity.

  • SetFogOfWarAlpha (Vector3 worldPosition, float radius, float fogNewAlpha, float border)

Fills or clears an area around worldPosition. The radius is the distance in meters, fogNewAlpha specifies the value of transparency of the fog of war on this position (0-1) and border parameter specifies the smoothness of the edges (0-1).

  • SetFogOfWarAlpha (Bounds bounds, float fogNewAlpha, float border)

Same than previous method but updates within a given bounds.

  • SetFogOfWarAlpha (List<Vector3> points, float fogNewAlpha, float border)

Same than previous method but apply the fog of war along a path given by points. Can be used to simulate a route in the mini-map.

  • GetFogOfWar(Vector3 position).
    Returns the transparency or level of fog of war at a given position.

  • fogOfWarTextureData: gets or sets the contents of the internal fog of war texture. Can be used to persist fog of war state between sessions.


  • OnPOIVisited: triggered when a POI is visited the first time (the POI is passed as parameter).

  • OnPOIVisible: triggered when a POI gets near than the visible distance (and appears in the compass bar).

  • OnPOIHide: triggered when a POI gets farther than the visible distance (and disappears in the compass bar).

  • OnHeartbeat: this event is triggered by the individual POI (it’s defined in CompassProPOI class and not in CompassPro). Triggered when the POI plays a heartbeat sound.

  • OnPOIVisibleInMiniMap: triggered when a POI appears in the mini-map.

  • OnPOIMiniMapIconMouseEnter: triggered when mouse enters an icon in the mini-map (as it enters the icon rectangle).

  • OnPOIMiniMapIconMouseExit: triggered when mouse exits an icon in the mini-map.

  • OnPOIMiniMapIconMouseDown: triggered when mouse button is pressed on an icon in the mini-map.

  • OnPOIMiniMapIconMouseUp: triggered when mouse button is released from an icon in the mini-map.

  • OnPOIMiniMapIconMouseClick: triggered when mouse button clicks on an icon in the mini-map.

  • OnMiniMapChangeFullScreenState: triggered when mini-map full screen mode is changed.

Back To Top