Starting with Pixyz C# (.NET) API
Prerequisites
- Visual Studio (website) recent version (eg.: 2022 v17.0.3)
- Pixyz On-Prem SDK local NuGet package (public release in July 2024). For more information meanwhile, please contact your Unity Partner or Pixyz team.
- A valid Pixyz SDK license or entitlement on your Pixyz license portal.
Important
Pixyz SDK can be found here : https://unity3ddist.jfrog.io/ui/repos/tree/General/pixyz-generic-prod-local
Packages and other langages/OS will progressively be made available starting July 24, 2024.
For direct integration of Pixyz assembly in your .NET project, this way: https://unity3ddist.jfrog.io/ui/repos/tree/General/pixyz-nuget-prod-local. Simply add this url as a NuGet source and install the PiXYZCSharpAPI package.
Configuring your development environement
Visual Studio
- Create a new project
- Use "Command Line" template as default unless specific requirements
- Setup a local NuGet package for Pixyz Engine SDK
Tools → Options
:
- Install the local Nuget Package
Tools → NuGet Package Manager → Manage NuGet Packages for Solutions
a. Click onBrowse
b. Change package source toLocal
c. Install to your C# project
Warning
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.
1. Open your project file (.csproj) (right click on project → Edit Project File)
2. Add the following configuration under your ItemGroup XML tag
Activating the license and initializing the SDK
You must initialize the Pixyz SDK and bind it to a valid license (usually by enabling a connection to a FlexLM server).
// init Pixyz
PiXYZAPI pxz = PiXYZAPI.Initialize();
// 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*/ }
}