Table of Contents

Method CreateAsync

Namespace
OBSStudioClient.Model
Assembly
OBSClient.dll

CreateAsync(string, CancellationToken)

Makes a profile, which becomes the current one, and returns when the model shows it.

public Task CreateAsync(string name, CancellationToken cancellationToken = default)

Parameters

name string

The name of the new profile: it can not be the name of another profile. The names are case sensitive.

cancellationToken CancellationToken

A token that ends the wait. A change that was not sent yet is not sent.

Returns

Task

A task that completes when Names lists the profile and Current is another profile than before the call: OBS Studio switched to the new one.

Remarks

OBS Studio answers before it has made the profile and switched to it; it lists the profile a moment later (about 40 milliseconds were measured) and says that it is the current one about 90 milliseconds after that, and the call returns then. Current is the new profile when it returns, unless the profile was switched away from again meanwhile (profiles that are made right after one another are made in that order, and the last one is current). The profile is a clean one: it has the settings that OBS Studio gives a new profile, not those of the profile that was current. See SetEnabledAsync(bool, CancellationToken) for the order of changes and the wait.

Exceptions

ArgumentException

name is empty.

ObsNameInUseException

There is a profile with that name. Nothing was changed.

ObsNotConnectedException

There is no connection to OBS Studio. Nothing was changed.

ObsNotReadyException

OBS Studio is changing its scene collection, or did so after the call. Nothing was changed.

ObsUnknownOutcomeException

OBS Studio did not answer in time, or the connection ended: it is not known whether it made the profile.

ObsNotConfirmedException

OBS Studio said that it made the profile, and the model does not list it: OBS Studio did not make it (it does not, and does not say so, when it can not make a folder name of the name), or it was removed again. Do not send the change again.

ObsResponseException

OBS Studio refused the change.