How to detect Recording? [SOLVED]

I am using Unity Recorder to record gameplay videos for marketing purposes.

In those videos, I want to remove certain UI elements. Just in recording, not in normal gameplay.

I’ve wasted long recordings forgetting to manually do this, so I want to automatically detect if Unity Recorder is recoding or not.

I’ve tried polling for GameObject.Find("Unity - RecorderSessions") as I can see a game object with that name in the hirarchy during recordings, but somehow it doesn’t ever trigger.

I am starting the game by pressing “Start Recording”.
Recording mode: Manual
Source: Game View

How can we detect if Unity Recorder is recording?

1 Like

Seconding this, I want to make a gameobject appear when recording that mimics the mouse cursor since the recorder hides it by default with no option to reveal it, but I’d like to automate the process of turning the object on and off depending on whether I’m in the process of recording a clip. Is there any way at all to poll the recording status?

Hi!
You can get instance of RecorderWindow and check recording status using IsRecording():

var windows = Resources.FindObjectsOfTypeAll<RecorderWindow>();
var recording = false;
foreach (var window in windows)
{
    if (window.IsRecording())
    {
        recording = true;
        break;
    }
}

if (recording)
    ...
else
    ...

This can be combined with Update() or coroutine to check when recording starts/ends:

private IEnumerator RecorderListenerCoroutine()
{
    var windows = Resources.FindObjectsOfTypeAll<RecorderWindow>();

    while (true)
    {
        var recording = false;
        foreach (var window in windows)
        {
            if (window.IsRecording())
            {
                recording = true;
                break;
            }
        }

        if (recording)
            ...
        else
            ...

        yield return null;
    }
}
1 Like

Thank you @ByMedion that works.

I’ve tested it in Awake, Start, and Update. For me, it detects recording in Awake, but not in Start, not in the first few Updates, and then again in Update after a few frames.

Since this is the first google result for this question, I thought I would pop in with the less hacky solution:

If Time.captureFramerate is not 0, then you are recording.

Sorry to revive the topic, but hopefully it saves someone else some time!

Regarding the Time.captureFramerate, it’s 0 in the first frame so make sure you wait at least one frame before checking it’s 0 or not.