NatML
Search…
⌃K

NatMLBundle

class NatML.Hub.NatMLBundleAttribute
When building your Unity app as a library to integrate into a native iOS or Android app, some of our APIs may throw errors relating to your application token being invalid. This happens because our APIs generate a one-time application token when building from Unity, and check that this token is valid at runtime before allowing the API to be used.
NatML application tokens are specific to your app's bundle ID.
If you are embedding your Unity project in a native app, you must override the bundle ID that is used to generate the NatML application token at build time:

Specifying your Bundle Identifier

/// <summary>
/// Specify an application bundle identifier.
/// </summary>
/// <param name="identifier">App bundle identifier.</param>
NatMLBundleAttribute (string identifier);
The attribute can be placed on any class or struct definition in your project. At build time, NatML APIs will find one such attribute and use it to generate an application token to be used at runtime. The attribute can be used like so:
ExampleScript.cs
using NatML.Hub;
// An example script that specifies the app's bundle identifier.
[NatMLBundle(@"com.mycompany.androidbundleid")]
public class ExampleScript : MonoBehaviour {
...
}