Getting Started

Up and Running in No Time

Importing NatShare

To begin, import the API with the Unity Package Manager by adding the following lines to your Packages/manifest.json file:

  "scopedRegistries": [
      "name": "NatML",
      "url": "",
      "scopes": ["ai.natml"]
  "dependencies": {
    "ai.natml.natshare": "1.3.0",

Specifying your Access Key

In order to use NatShare, you need a NatML access key. Retrieve your access key from NatML Hub:

Once you have your access key, add it in Project Settings > NatML:

Sharing a Screenshot

With NatShare imported, let's write a quick script to share a screenshot:

using UnityEngine;
using NatML.Sharing;

public class ShareScreenshot : MonoBehaviour {
    void Start () {
        // Capture a screenshot
        var screenshot = ScreenCapture.CaptureScreenshotAsTexture();
        // Create a share payload
        using var payload = new SharePayload();
        // Add the image
        // Share!

Add this component to any game object in your scene; build onto an iOS or Android device, and run. You should get a native popup asking the user to share the item!

Make sure to look through the minimum requirements before delving into the API.

Last updated