Skip to content

Unity Guide

Michael Yarichuk edited this page Oct 18, 2026 · 1 revision

Unity Guide

Supports Unity 2021.3+ via the netstandard2.1 build. It is IL2CPP-safe (CI runs a NativeAOT smoke test).

Install via scoped registries

Add to Packages/manifest.json:

{
  "scopedRegistries": [
    { "name": "OpenUPM", "url": "https://package.openupm.com", "scopes": ["com.rogueliketoolkit"] },
    { "name": "UnityNuGet", "url": "https://unitynuget-registry.openupm.com", "scopes": ["org.nuget"] }
  ],
  "dependencies": {
    "com.rogueliketoolkit.entities": "6.0.0",
    "com.rogueliketoolkit.entities.scripting.jint": "6.0.0"
  }
}

Drop the scripting line if you do not use scripts. Check the releases page for the current version.

Install without registries

Download RoguelikeToolkit.Entities-<version>-unity-plugins.zip from a GitHub Release and unzip into Assets/Plugins/RoguelikeToolkit.Entities/. Skip DLLs your project already has (e.g. System.Runtime.CompilerServices.Unsafe).

Code stripping

Your component types are populated by reflection. Protect them with [Preserve] or an Assets/link.xml:

<linker>
  <assembly fullname="MyGame.Components" preserve="all" />
</linker>

The packages preserve themselves, DefaultEcs, YamlDotNet and Jint automatically.

Older IL2CPP (before 2022.1)

AotComponentRegistry.Register<Health>();   // once per component type at startup

Loading files

Use Application.streamingAssetsPath or persistentDataPath for template folders; on platforms where StreamingAssets is not a real folder (Android), read the text yourself and call repository.LoadTemplate(name, content).

Clone this wiki locally