Runtime Preset
Preset for components that can be applied at runtime
com.gilzoide.runtime-preset Unity Compatibility
Unity 6 Supported
2023.2 Supported
2023.1 Supported
2022.3 LTS Supported
2021.3 LTS Supported
2020.3 LTS Not tested
2019.4 LTS Not tested

Install via UPM
Add to Unity Package Manager using this URL
https://www.pkglnk.dev/runtime-preset.git README Markdown
Copy this to your project's README.md
## Installation
Add **Runtime Preset** to your Unity project via Package Manager:
1. Open **Window > Package Manager**
2. Click **+** > **Add package from git URL**
3. Enter:
```
https://www.pkglnk.dev/runtime-preset.git
```
[](https://www.pkglnk.dev/pkg/runtime-preset)Dependencies (1)
README
Runtime Preset
Functionality analogous to Unity's Preset that can be used at runtime and prefab/scene import time.
Features
RuntimePreset: assets analogous to Unity's Preset that can be applied at runtime
- Apply presets by calling the
ApplyToorTryApplyTomethods - Create runtime presets from existing MonoBehaviour or ScriptableObjects by using the "Create Runtime Preset" context menu item. This is the recommended way to create runtime presets.
- Custom editor uses
Preseteditor, making it super easy and intuitive to edit values - Optionally implement IRuntimePresetListener in your MonoBehaviour or ScriptableObject subclass to get notified when a runtime preset has been applied to it
- If the preset was created from a component, uses
GetComponentwhen applied to a GameObject to get the correct target object
RuntimePresetApplier: component that applies presets to the corresponding target objects
- Apply presets by calling the
Applymethod - Supports automatic application in
Awake,OnEnableandStart - Runs before other scripts, so that new values from automatically applied presets should be available on your components'
Awake,OnEnableandStartmethods - Presets can be applied at prefab/scene import time by checking "On Import" in the "Apply At" flags
- Optionally mark the checkbox "Destroy After Import" to destroy the runtime preset applier right after importing, to avoid any runtime processing
- Prefabs with presets applied at import time are reimported automatically if preset values get changed in the inspector
Caveats
- Only works with MonoBehaviour and ScriptableObject subclasses
- Field types that don't work yet:
- Gradient
- Arrays/lists
How to install
Either:
- Use the openupm registry and install this package using the openupm-cli:
openupm add com.gilzoide.runtime-preset - Install using the Unity Package Manager with the following URL:
https://github.com/gilzoide/unity-runtime-preset.git#1.0.0-preview2 - Clone this repository or download a snapshot of it directly inside your project's
AssetsorPackagesfolder.
Comments
No comments yet. Be the first!
Sign in to join the conversation
Sign In