Skip to content

Protection API

Ellie edited this page Oct 8, 2023 · 1 revision

Overview

The protection API available is pretty simple. It provides you with a single class to instantiate and method to call to process the files.

Prowlynx.Protection.UnityProtector

This class is the main class for protecting Unity applications.

The constructor takes the following arguments:

  • Folder Path - string - The output folder for the Unity build for Standalone Win64.
  • Unity Version (yyyy.x format) - string - The version of Unity: 2020.3, 2021.3, 2022.3.
  • Protect Assembly List - string[] - The assembly list to protect, these are often located within the _Data -> Managed folder.
  • Log Error - Action<string> - The function to log errors with, Debug.LogError may be appropriate.
  • Log Warning - Action<string> - The function to log warnings with, Debug.LogWarning may be appropriate.
  • Log Info - Action<string> - The function to log info with, Debug.Log may be appropriate.
/// <summary>
/// Create a new Prowlynx Unity Protector for a Unity game build.
/// </summary>
/// <param name="folderPath">The output folder for the Unity build for Standalone Win64.</param>
/// <param name="unityVersion">The version of Unity: 2020.3, 2021.3, 2022.3.</param>
/// <param name="protectAssemblyList">The assembly list to protect, these are often located within the _Data -> Managed folder.</param>
/// <param name="logError">The function to log errors with, Debug.LogError may be appropriate.</param>
/// <param name="logWarning">The function to log warnings with, Debug.LogWarning may be appropriate.</param>
/// <param name="logInfo">The function to log info with, Debug.Log may be appropriate.</param>
/// <exception cref="ArgumentException">Thrown when null inputs.</exception>
/// <exception cref="ArgumentNullException">Thrown when null inputs.</exception>
public UnityProtector(string folderPath,
                        string unityVersion,
                        string[] protectAssemblyList,
                        Action<string> logError,
                        Action<string> logWarning,
                        Action<string> logInfo)

Prowlynx.Protection.UnityProtector.Process

There are no arguments for this function. This method returns a bool indicating whether the process was successful. Check the log function results for more information. Possible reasons it fails are:

  • The file(s) specified were not .NET files (native files?).
  • The file(s) specified were Native AOT (Ready2Run files) or not ILOnly.
  • The file(s) did not have any methods to protect.
  • The file(s) were already protected or the method body reader could not process the method body. Do you have another obfuscator?
Clone this wiki locally