/// <summary>
            /// Initializes a new instance of the <see cref="Target" /> class.
            /// </summary>
            /// <param name="name"> Image target's name. </param>
            /// <param name="image"> Texture2D representing the image target. The size of the texture should not be changed. Set the "Non Power of 2" property of Texture2D to none. </param>
            /// <param name="longerDimension"> Longer dimension of the image target in scene units. Default is meters. </param>
            /// <param name="callback"> Tracking result callback for this image target. </param>
            /// <param name="handle"> Handle for the image tracker. </param>
            /// <param name="isStationary"> Set this to true if the position of this image target in the physical world is fixed and its surroundings are planar (ex: walls, floors, tables, etc). </param>
            public Target(string name, Texture2D image, float longerDimension, OnImageResultDelegate callback, ulong handle, bool isStationary = false)
            {
                this.targetSettings       = MLImageTracker.Target.Settings.Create();
                this.targetStaticData     = new NativeBindings.MLImageTrackerTargetStaticDataNative();
                this.nativeTrackingResult = new NativeBindings.MLImageTrackerTargetResultNative();

                // It is assumed that all the parameters are valid as this class should only be used by the MLImageTracker,
                // which already has checks for these values before it creates the MLImageTracker.Target.
                this.targetSettings.Name            = name;
                this.targetSettings.LongerDimension = longerDimension;
                this.targetSettings.IsStationary    = isStationary;
                this.trackerHandle = handle;
                this.OnImageResult = callback;

                this.imageData    = MLTextureUtils.ConvertToByteArray(image, out int numChannels);
                this.targetHandle = MagicLeapNativeBindings.InvalidHandle;

                MLResult.Code result = NativeBindings.MLImageTrackerAddTargetFromArray(this.trackerHandle, ref this.targetSettings, this.imageData, (uint)image.width, (uint)image.height, (numChannels == 4) ? MLImageTracker.ImageFormat.RGBA : MLImageTracker.ImageFormat.RGB, ref this.targetHandle);

                if (result == MLResult.Code.Ok && this.IsValid && MagicLeapNativeBindings.MLHandleIsValid(this.trackerHandle))
                {
                    result = NativeBindings.MLImageTrackerGetTargetStaticData(this.trackerHandle, this.targetHandle, ref this.targetStaticData);
                    if (result != MLResult.Code.Ok)
                    {
                        MLPluginLog.ErrorFormat("MLImageTracker.Target.Target failed to get static data for target. Reason: {0}", result);
                    }
                }
                else
                {
                    MLPluginLog.ErrorFormat("MLImageTracker.Target.Target failed, one or both handles are invalid: Tracker Handle: {0}, Existing Target Handle: {1}. Reason: {2}", this.trackerHandle, this.targetHandle, result);
                }
            }
 public static extern MLResult.Code MLImageTrackerUpdateTargetSettings(ulong trackerHandle, ulong targetHandle, ref MLImageTracker.Target.Settings targetSettings);
 public static extern MLResult.Code MLImageTrackerAddTargetFromArray(ulong trackerHandle, ref MLImageTracker.Target.Settings targetSettings, [MarshalAs(UnmanagedType.LPArray)] byte[] imageData, uint width, uint height, MLImageTracker.ImageFormat format, ref ulong targetHandle);