Version: 2022.1
LanguageEnglish
  • C#

VersionControlManager.SetVersionControl

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static bool SetVersionControl(string name);

Parameters

name Unique version control system name.

Returns

bool Returns true if VCS has been activated. false otherwise.

Description

Sets the active version control system.

If a different VCS was previously active, it will be deactivated. You can use the versionControlDescriptors property to retrieve all the available version control systems. You can check the newly activated VersionControlObject by using the activeVersionControlObject property.

using UnityEditor;
using UnityEditor.VersionControl;
using UnityEngine;

static class Example { [MenuItem("Example/Set Custom VCS")] static void SetCustomVCS() { if (!VersionControlManager.SetVersionControl("Custom")) Debug.LogWarning("Failed to set custom VCS."); } }