Markers & Lines API

advanced scripting

World Map Strategy Kit · Scripting Support (C#)

Class: WMSK (namespace WorldMapStrategyKit)

Markers API

Methods for adding markers, lines, and custom graphics to the map.

Properties

bool showCursor

Toggle cursor lines visibility.

Color cursorColor

Gets or sets the cursor color.

bool cursorFollowMouse

Makes the cursor follow the mouse when it's over the World.

Vector2 cursorLocation

Gets or sets the cursor location.

bool cursorAlwaysVisible

Gets or sets the cursor always visible.

bool showLatitudeLines

Toggle latitude lines visibility.

int latitudeStepping

Specify latitude lines separation.

bool showLongitudeLines

Toggle longitude lines visibility.

int longitudeStepping

Specify longitude lines separation.

Color imaginaryLinesColor

Gets or sets the imaginary lines color.

2D Sprite Markers

Text Markers

TextMesh AddMarker2DText(string text, Vector3 planeLocation, Font font = null, Color color = default)

Adds a TextMesh label marker at a location.

TextMeshPro AddMarker2DTextPro(string text, Vector3 planeLocation, Color color, float scale = 1f)

Adds a TextMeshPro label marker (requires TextMesh Pro package).

Lines

LineMarkerAnimator AddLine(Vector2 start, Vector2 end, Color color, float width = 0.01f)

Draws a line between two map positions. Returns a LineMarkerAnimator for controlling the line.

LineMarkerAnimator AddLine(Vector2[] points, Color color, float width = 0.01f)

Draws a multi-segment line through an array of map positions.

Circles & Shapes

GameObject AddCircle(Vector2 position, float kmRadius, Color color, bool overdraw = default, float borderWidth = 0f)

Adds a circle marker at a map position with radius in kilometers.

Marker Management

void ClearMarkers()

Removes all markers added with AddMarker* methods.

Additional Methods

MarkerClickHandler AddMarker3DObject(GameObject marker, Vector3 planeLocation, float scale, bool enableEvents, bool adjustRotation)

Adds a custom marker (gameobject) to the map on specified location and with custom scale multiplier. Returns a MarkerClickHandler reference if enableEvents is true

MarkerClickHandler AddMarker3DObject(GameObject marker, Vector3 planeLocation, Vector3 scale, float pivotY, bool enableEvents, bool adjustRotation)

Adds a custom marker (gameobject) to the map on specified location and with custom scale. Returns a MarkerClickHandler reference if enableEvents is true

void UpdateMarker3DObjectPosition(GameObject marker, Vector3 planeLocation)

Updates a custom marker (gameobject) position preserving scale and height. Can be used after calling AddMarker3DObject to move units over the 2D map.

GameObject AddCircleOnSphere(Vector2 position, float kmRadius, float ringWidthStart, float ringWidthEnd, Color color, bool overdraw, int renderOrder, bool enableEvents)

Adds a custom marker (circle) to the map on specified latitude/longitude and with custom size in km. Circle segments will follow latitude/longitude with accuracy so it can look distorted on a 2D map. Position in local map coordinates for the center of the circle. Radius in KM. Ring inner limit (0..1). Pass 0 to draw a full circle. Ring outer limit (0..1). Pass 1 to draw a full circle. Color If this circle can draw over other shapes Order for rendering this circle Circle will emit click events through the marker events: OnMarkerClick, etc.

GameObject AddCircleOnSphere(float latitude, float longitude, float kmRadius, float ringWidthStart, float ringWidthEnd, Color color, bool overdraw, int renderOrder, bool enableEvents)

Adds a custom marker (circle) to the map on specified latitude/longitude and with custom size in km. Circle segments will follow latitude/longitude with accuracy so it can look distorted on a 2D map. Radius in KM. Ring inner limit (0..1). Pass 0 to draw a full circle. Ring outer limit (0..1). Pass 1 to draw a full circle. Color If this circle can draw over other shapes Order for rendering this circle Circle will emit click events through the marker events: OnMarkerClick, etc.

void ClearLineMarkers()

Removes all marker lines.

void GetMarkers(List results)

Returns a list of all added markers game objects The markers.

void GetMarkers(Country country, List results)

Returns a list of all added markers game objects inside a given country The markers.

void GetMarkers(Province province, List results)

Returns a list of all added markers game objects inside a given province The markers.

void GetMarkers(Cell cell, List results)

Returns a list of all added markers game objects inside a given cell The markers.

void GetMarkers(Region region, List results)

Returns a list of all added markers game objects inside a given region The markers.

Transform GetMarker(Vector2 mapLocation, float expandMarkerBoundsAmount)

Returns the marker existing at the map coordinates

Transform GetMarker(Vector2 mapLocation, List fromMarkers, float expandMarkerBoundsAmount)

Returns the marker existing at the map coordinates from a given list of markers

bool CancelMarkerDrag(bool returnToStartPosition)

Cancels an ongoing marker drag

Was this page helpful?