Skip to content
lootlockerPublic

About

The Unity SDK for LootLocker

Topics

Resources

Stars

70 stars

Watchers

3 watching

Forks

Repository files navigation

LootLocker Unity SDK

LootLocker

About • Installation • Configuration • Updating • Support • Development


About

LootLocker is a game backend-as-a-service that unlocks cross-platform systems so you can build, ship, and run your best games.

Full documentation is available here https://docs.lootlocker.com/

Installation

From Open UPM openupm

The preferred way of installing the LootLocker SDK is through Open UPM. This way you will receive future updates in a streamlined way. Please refer to OpenUPM for their simple install instructions or our official documentation.

From Git

Before you start you need to have git installed on your computer.

  • In the Unity Editor go to Window > Package Manager
  • Click the + at the top left of the Package Manager window
  • Select Add package from git URL...
  • Paste the following URL https://github.com/LootLocker/unity-sdk.git and click Add

Other install methods

For other methods, please refer to our official documentation.

Configuration

For a full walkthrough of how to configure the SDK, please see our Guide to Configuring the Unity SDK. But here's a short explanation:

Using the LootLocker Unity Extension (since Unity v2021)

  • Open the LootLocker Extension in Unity (Windows > LootLocker)
  • Sign in with your LootLocker account
  • Select your game, environment, and game key.

Configuring the SDK manually

Multiple configurations

You can keep several named config files in one project and switch between them without recompiling. This is how you keep, for example, a dev config with verbose logging and a prod config with logging off, or one config per platform.

Naming. Put the files next to the config asset, in Assets/LootLockerSDK/Resources/Config/, and name them LootLockerConfig-<id>.bytes. The <id> may contain letters, digits, ., _ and -, and must start with a letter or digit. The unsuffixed LootLockerConfig.bytes keeps working exactly as before and is shown as Default.

Selecting. Open Edit > Project Settings > LootLocker SDK. When more than one config file is present a Config File dropdown appears. Files that cannot be parsed, or that have no api_key, are listed greyed out with the reason, so a broken file is visible but cannot be selected. With a single config file there is nothing to choose and no dropdown is shown.

If you add config files and never pick one, the SDK uses the first in lexicographical order rather than leaving file config unset. Adding files is an expression of intent, and a silent "no config" is a confusing result. The choice is stable regardless of file system enumeration order, and the dropdown reports which file auto-detect resolved to. Pick a specific file, or (None), to override it.

Obfuscated configs. A config file may be plain JSON or an obfuscated payload — base64 of an AES-encrypted JSON document, produced by LootLockerEncryptionUtilities.SimpleEncryptToBase64. Discovery, the dropdown, and the load path all decrypt before parsing, so an obfuscated file is classified and selectable exactly like a plain one, and plain and obfuscated profiles can be mixed in the same project. A file that is valid base64 but not a payload this SDK produced is reported as invalid with the decryption error, not as unreadable.

Local overrides. A shared config is the right place for team-wide values, but not for a one-off change. Click the closed padlock next to a setting to write a local Assets/LootLockerSDK/LocalOverrides/LootLockerConfig.local.bytes that is layered on top of the selected config. The file is sparse: only the fields it contains are applied, so overriding log_level leaves every other setting shared. Overridden settings are marked (local override) in Project Settings, and the open padlock resets them. Switching config file also clears the file, because an override written against one config does not apply to another.

The file is local and must not be committed. It is listed in the SDK's .gitignore, but the same applies under any version control — add it to whatever ignore mechanism your team uses (Perforce, Plastic SCM, SVN, and so on). The API and domain keys are deliberately not overridable: they identify which game the project talks to, so a silent per-machine override would mean the settings say one game and the build talks to another.

The override file is editor only, and deliberately outside Resources/. Anything under Resources/ is packed into every build made on that machine, so an override stored there would ship a local api_key or log_in_builds value to players even if the SDK never read it. It is a developer convenience, not a build input.

CI. Select a config without touching the editor:

Unity.exe -batchmode -quit -lootlockerconfig prod-ps5
Unity.exe -batchmode -quit -lootlockerconfig none

An invalid identifier is logged as an error and treated as none rather than guessed at.

Precedence, highest first:

  1. An explicit LootLockerSDKManager.Init(...) call. Process lifetime only; never written to disk.
  2. -lootlockerconfig on the command line.
  3. The local override file (editor only).
  4. The selected config file.
  5. The legacy LootLockerConfig.bytes.
  6. The values stored in the config asset.

-lootlockerconfig none disables file config entirely, including the local override.

Only the selected config ships. Files under Resources/ are packed into the build and are trivially readable from a shipped game, so "the SDK only reads one of them" is not key hygiene — the others would still be in the build data. Before a build, every config file except the one in effect is renamed with a trailing ~, which Unity ignores at import, and restored afterwards. The player reads the surviving config through a generated LootLockerConfig.build.bytes pointer.

So a dev key on disk cannot end up in a prod build. What gets stripped is decided by the same precedence as above, so -lootlockerconfig prod on a CI build strips everything else.

Two things to know:

  • During a build, your version control client briefly shows the other configs as renamed. Restore is automatic.
  • If the editor is killed mid-build, the files stay hidden until the next editor start, which restores them automatically. Nothing is lost — the files are renamed, not deleted.

Two limitations worth knowing:

  1. The selection is a single committed value, so it is shared by everyone on the project. Per-build target selection is not implemented yet.
  2. API keys in config files are not secrets. They are readable by anyone with the build. This feature improves key hygiene — keeping the right key on the right target — not secrecy.

Updating

If you have installed the SDK from Open UPM then all you have to do in Package Manager is press the Update button when that tells you there's a new version.

For other install methods and more information, head over to our official documentation.

Managed code stripping

The SDK ships a link.xml at the package root that preserves the types and members it reaches through reflection when deserializing server responses. The Unity linker only reads link.xml files that live under your project's Assets/ folder, so the SDK registers its own file with the linker through an IUnityLinkerProcessor (Runtime/Editor/LootLockerLinkXmlProcessor.cs). This happens automatically — no setup required.

If you enable Managed Stripping Level (Medium or High) in Player Settings, do not delete the package's link.xml or the processor. Without them, responses deserialize into non-null objects whose members are all default values, which fails silently rather than throwing.

If you need to add preservations for your own types, put them in a separate link.xml under your project's Assets/ folder. Multiple link.xml files are supported and are merged by the Unity linker.

Support

If you have any issues or just wanna chat you can reach us on our Discord Server

Development

Testing the SDK

Status: Test SDK with Unity

To set up the tests, you must add our package to the manifest.json testables underneath dependencies. Your manifest.json should look something like this:

{
  "dependencies": {
    "com.lootlocker.lootlockersdk": "https://github.com/lootlocker/unity-sdk.git",
    many more dependencies...
  },
  "testables": ["com.lootlocker.lootlockersdk"]
}

Once you have done this, you can go into Unity and go to Window -> General -> Test Runner. This will open a new window which should already include all the tests available, Then all you have to do is press Run All and the tests will begin.

If you are running the tests towards the LootLocker production environment you will need to provide a username and password to an existing user either by setting the values directly in LootLockerTestConfigurationUser::GetProductionUser or via command line arguments -adminemail and -adminpassword. Bear in mind that your tests will be rate limited when running towards production (and in general this is a bad idea).

About

The Unity SDK for LootLocker

Topics

Resources

Stars

70 stars

Watchers

3 watching

Forks

Releases

Contributors

Languages