Back to Et

Unity SemVer

Packages/com.halodi.halodi-unity-package-registry-manager/Editor/ThirdParty/Unity-SemVer/README.md

latest1.2 KB
Original Source

Unity SemVer

A convenient way to edit and compare version numbers according to the Semantic Versioning 2.0.0 specification. Also includes a property drawer for Unity.

Installation

Install the package games.artees.semver using my package registry. Or install via the OpenUPM registry.

Usage

Use the Artees.UnitySemVer.SemVer class or apply the Artees.UnitySemVer.SemVerAttribute attribute to a string field.

public SemVer version = new SemVer {major = 1, minor = 2, patch = 3};
[SemVer] public string versionString = "1.2.3";

Parsing:

var version = SemVer.Parse("2.0.0-rc.1+build.123");

Comparing:

Debug.Log("2.1.0"  > version);

Validating:

var result = version.Validate();
version = result.Corrected;
foreach (var message in result.Errors)
{
    Debug.LogWarning(message);
}