Skip to content

Unity

The Unity package gives you three components: a face source (the camera), MimicFace (gestures to UnityEvents and C# callbacks) and MimicCalibration (calibration with player prompts and a stored profile). A simulated face lets you build and test bindings in the Editor without a camera.

  • Unity 2022.3 LTS or Unity 6 (tested on 6000.3).
  • For the camera: the MediaPipe Unity Plugin 0.16 (MIT). Windows, macOS and Linux Editors, Android and iOS.
  • Any render pipeline: the components draw nothing.
  1. Configure access, then add Mimic by git URL in Window → Package Manager → + → Add package from git URL:

    https://github.com/vidrip/vidrip-mimic-sdk.git?path=unity/com.vidrip.mimic#v0.1.0
  2. For the camera, download com.github.homuler.mediapipe-0.16.3.tgz from the plugin’s releases into your project (for example Packages/vendor/) and add it with Add package from tarball.

Mimic’s camera provider compiles only when the plugin is present, so the package works without it, using the simulated face only. Unity warns that both packages lack a Unity signature; that’s expected for packages installed from outside the Unity registry.

On one GameObject, add:

Component What it does
Mimic MediaPipe Source (camera) Opens the front camera (or the first one), runs the face tracker and publishes face samples.
Mimic Face Set Source to the component above. Pick the Spec Profile: Web for a desktop webcam, Phone on iOS and Android. Add rows to Bindings.
Mimic Calibration Calibrates on start, or loads the stored profile, and raises onProgress, onPrompt, onCalibrated and onFailed for your UI.

Each Bindings row is a gesture plus two UnityEvents: On Start (with the strength as a float) and On End. Wire them to your behaviours like any button event.

Calibration only counts frames with a face in them, so Calibrate On Start works as long as the camera opens within a few seconds. To be certain, turn it off and call MimicCalibration.Begin() once the source’s IsReady is true (the camera has delivered frames).

using Vidrip.Mimic;
using Vidrip.Mimic.Unity;
public class Player : MonoBehaviour
{
[SerializeField] MimicFace face;
void Start()
{
face.On(Gesture.Blink, e => { if (e.Phase == GesturePhase.Start) Fire(); });
face.On(Gesture.HeadLeft, e => { if (e.Phase == GesturePhase.Start) MoveLeft(); });
face.On("brows.*", e => Surprise(e.Phase == GesturePhase.Start));
}
}

Events always arrive on the main thread, in Update, even though the camera provider runs off it. On returns an Action that unsubscribes.

Add Mimic Simulated Source instead of the camera source and drive the face from the Inspector: eye openness, gaze, smile, mouth, brows and head pose. It produces the same samples as a camera, so bindings and calibration behave as they will on a real face. The package’s Basic sample (Package Manager → Mimic → Samples) builds a small character that blinks, smiles, raises its brows and turns with you, and switches between the simulated face and your camera.

Mimic Recorder writes a source’s raw samples to a JSONL file, each frame tagged with a label you set. Use it to send us a reproducible bug report or to check thresholds against your own players.