C# SDK
Prerequisites
- Compatible system
- Visual Studio
- .NET Framework
- A valid Pixyz SDK license on your Pixyz license portal
Setup
Standard install (recommended)
- Open a .NET project
- Go to
Tools/NuGet Package Manager/Package Manager Settings/Package Sources
- Add a new source
- Set source URL to:
https://unity3ddist.jfrog.io/ui/repos/tree/General/pixyz-nuget-prod-local
- Open
NuGet Package Manager
window and look for Pixyz NuGet packages (be sure to set Package source toAll
) - Setup your license
- Run your first script
Local install
- Download desired package from archive
- Open a .NET project
- Setup a local NuGet package for Pixyz SDK
Tools/Options
: - Install the local package:
Tools/NuGet Package Manager/Manage NuGet Packages for Solutions
- Click on
Browse
- Change package source to
Local
- Install to your C# project
- Click on
- Setup your license
- Run your first script
.NET 8
Some .NET version discrepencies may occur. .NET 8
included a change in how platform-specific packages are loaded. To safely use .NET 8 and depending on your Pixyz release version, you might need a custom configuration to use the Windows package:
- Open your project file (.csproj) (right click on project → Edit Project File)
- Add the following configuration under your ItemGroup XML tag:
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true"/>
Run your first script
using UnityEngine.Pixyz.API;
// init Pixyz
PiXYZAPI api = PiXYZAPI.Initialize();
// print Pixyz version
Console.WriteLine(api.Core.GetVersion());
// if no license is found, try to configure a license server
if (!pxz.Core.CheckLicense()) {
pxz.Core.ConfigureLicenseServer("company-server-hostname", 27000, true);
}
// add all tokens
foreach (var token in pxz.Core.ListTokens().list) {
try {
pxz.Core.NeedToken(token);
}
catch { /* catch silently*/ }
}
// use api.IO.ImportScene to import a file and enjoy :)