• Docs
  • Releases
  • API Reference
  • Login
  • Languages iconEnglish
    • 日本語

›Admix Unity SDK API Reference

Admix Unity SDK API Reference

  • Introduction to the Admix Unity Plugin API
  • Placements Queue Management Events
  • Placement Load Events
  • Gaze events and other event types
  • Reporting API

Gaze Events and Other Event Types

Gaze events allow triggering an action when an ad has been looked at. That is, when the centre of the user’s view has crossed the border of the creative inside the placement. We detect when the gaze has entered and left the creative using the following events:

  • PlacementsEvent.GazeStartEvent.OnGazeStart - Triggered when a camera starts looking at the placement.
  • PlacementsEvent.GazeEndEvent.OnGazeEnd - Triggered when a camera stops looking at the placement.
  • PlacementsEvent.TouchClickEvent.OnTouchClick - Triggered when a player has touched the banner. This feature works only if the placement has the touch click feature enabled (note, this event is availible only in the SDK2.1)
  • PlacementsEvent.OnHidden.OnPlacementHidden - Triggered when the banner is transparent. Please note, if Admix does not fill the banner with ad content it will be transparent by default.
  • PlacementsEvent.OnShown.OnPlacementShown Triggered when the banner renders ad content. Please note, if the Admix banner receives the next ad's content with ad content already rendered this event will be called again.

Important!

If you're using more than 1 camera in your scene, you have to attach the AdmixCamera script to each camera that does not have the 'MainCamera' tag. This script helps Admix to recognize active cameras which is necessary to validate ad impressions and views. Attaching this script resolves the warning "Admix: No camera availible for gaze tracking" for the SDK2.2.

Setting up placement events through the inspector

You can set up a gaze event object to control actions for all supported events in every individual Admix placement.

Placement events

Defining actions for Admix SDK events through the SDK API

Gaze start event code example:

C#
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.GazeStartEvent.OnGazeStart.AddListener(arg1 =>
{
DoSomething();
});
}
}

Gaze end event code example:

C#
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.GazeEndEvent.OnGazeEnd.AddListener(arg1 =>
{
DoSomething();
});
}
}

Gaze click event code example:

C#
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.ClickEvent.OnClick.AddListener(arg1 =>
{
DoSomething();
});
}
}

Gaze touch-click event code example:

C#
using Admix.AdmixCore.AdmixEvents;
using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.TouchClickEvent.OnTouchClick.AddListener(arg1 =>
{
DoSomething();
});
}
}

OnShown event code example:

C#

using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
AdmixPlacementGameObject.PlacementsEvent.OnShown.OnPlacementShown.AddListener(arg1 =>
{
DoSomething();
});
}
}

OnHidden event code example:

C#

using Admix.AdmixCore.AdmixPlacements;

public AdmixPlacementBase AdmixPlacementGameObject;

public class CodePlacementEvents : MonoBehaviour
{
private void Awake()
{
toSubscribe1.PlacementsEvent.OnHidden.OnPlacementHidden.AddListener(arg1 =>
{
DoSomething();
});
}
}
← Placement Load EventsReporting API →
  • Setting up placement events through the inspector
  • Defining actions for Admix SDK events through the SDK API
    • Gaze start event code example:
    • Gaze end event code example:
    • Gaze click event code example:
    • Gaze touch-click event code example:
    • OnShown event code example:
    • OnHidden event code example:
Documentation
TutorialsReleasesAPI Reference
Admix
Admix HomepageLogin
Copyright © 2022 Admix