Cryptolens.Licensing.CrossPlatform.dll
. You can also install it through NuGet.
Cryptolens.Licensing.CrossPlatform
depends on the Newtonsoft.Json
library. In earlier versions of Unity, the Newtonsoft.Json.dll
had to be included alongside the Cryptolens.Licensing.CrossPlatform.dll
file (it is provided in the same zip file as our library).
In later versions (from our tests, since 2020.3.16f1), Unity added Newtonsoft.Json as an internal package, meaning that it no longer needs to be included in the Asset folder. However, depending on the Newtonsoft.Json version used by Unity, you may have to recompile our library to target that version. In sum, there are three cases:
If Unity does not have an internal Newtonsoft.Json package
This is the case for older versions of Unity (from our tests, for versions earlier than 2020.3.16f1). In this case, you need to include both Cryptolens.Licensing.CrossPlatform.dll
and Newtonsoft.Json.dll
.
If Unity uses Newtonsoft.Json v13
In this case, we recommend using the .NET Framework 4.8 binary (in the net48 folder) without including the Newtonsoft.Json.dll
file. It should be possible to use the .NET Standard assembly too, and this has been tested in 2022.3.39f1. However, if you are using an older version of Unity, you might need to change a setting to enable .NET Standard. We have outlined this in the Considerations section at the bottom of this page.
If you are using the latest LTS version of Unity, it should already by targeting Newtonsoft.Json v13.If Unity uses a different version of Newtonsoft.Json In this case, our library needs to be recompiled with a few changes. The steps are as follows:
Cryptolens.Licensing.CrossPlatform.csproj
. Remove the following lines:13.0.1
to 12.0.3
(or any other version you would like to use) in the section below:sln
files) and run the following command: dotnet build Cryptolens.Licensing.CrossPlatform.sln
.Cryptolens.Licensing\bin\Debug\net48
(or Cryptolens.Licensing\bin\Release\net48
) and copy the Cryptolens.Licensing.CrossPlatform.dll
into the assets folder.LoadFromFile
and LoadFromString
with the RSAPubKey. The format of the license file should be set to Other languages (see more here) when downloading it in the dashboard or using Activation Forms.
You can download a sample project here.
LicenseKey.FromResponse(result).SaveToFile()
to be able to use the extension methods, eg. result.LicenseKey.SaveToFile()
will not work.
GetMachineCode()
and IsOnRightMachine()
methods require root access on Linux. If you are using Unity with IL2CCP, Helpers.GetMacAddress()
can be a better alternative, since other methods may throw an error.
Some users who build and then run the unity project may get a null response from Key.Activate
, which will be treated as if the license key is invalid. We recommend to set API Compatibility level to .NET 4.x in Edit > Project Settings > Player > Other Settings > API Compatibility Level. In this case, the the binaries for .NET 4.* need to be used, i.e. not the .NET Standard version.