ARToolKit for Unity Scripts

From ARToolworks support library

Jump to: navigation, search

Main Page > ARToolKit for Unity > ARToolKit for Unity Scripts



The ARToolKit script manages the overall operation of the tracking plugin. It performs the necessary native plugin calls, and allows the developer to configure general settings. There should only ever be one ARToolKit script in a scene.

  • Version: The version number of ARToolKit on which the plugin is built.

Video Options

  • Configuration: Configuration string passed to the video capture module (more details).
  • Near Plane: Near plane value used when constructing projection matrix. Measured in metres by default. Decrease to allow a closer camera.
  • Far Plane: Far plane value used when constructing projection matrix. Measured in metres by default. Increase to allow a more distant camera.
  • Layer: The Unity layer in which the video plane will be rendered.

Threshold Options

  • Mode: The thresholding mode to use. The standard ARToolKit options are available: Manual, Median, Otsu, Adaptive. Different configuration options appear depending on the selected mode.


The Marker script represents one tracked marker in the system. Add one for each individual marker that you want to track.

  • Tag: A unique name that identifies this marker.
  • ID: The internal ID number for this marker. Starting at -1, this number will simply increase. It can be safely ignored.
  • Type: The type of marker. Currently only single template markers are supported.
  • Marker: The marker to use. This list is populated by the marker files placed in the Assets/Resources/ardata/markers directory.
  • Width: The width of the marker in metres.


The TrackedCamera script associates markers with cameras. Add this to a camera and link it to a marker to update the camera's pose at runtime.

  • Tag: The unique name of the marker that this camera should take its pose from. This should match an existing Marker script's tag.
  • Stay Visible: The length in seconds of how long the camera should stay active after marker tracking is lost. For example, using a value of 0.25 will give one quarter of a second delay before the marker's content disappears. This can reduce the effect of flickering.
  • Got marker: Simply displays whether the entered tag matches an existing Marker.
  • Marker ID: The ID of the marker that is linked to this camera via the tag. May be -1 until the pattern is actually loaded.


The TrackedCamera generates the following events, using Unity's SendMessage command. To handle these events, implement the matching event handler in a script, and attach it to the TrackedCamera.

  • void OnMarkerLost(Marker marker)
  • void OnMarkerFound(Marker marker)
Personal tools