Unclaimed Package Is this your package? Claim it to unlock full analytics and manage your listing.
Claim This Package

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

Style
Preview
pkglnk installs badge
## 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
```

[![pkglnk](https://www.pkglnk.dev/badge/runtime-preset.svg?style=pkglnk)](https://www.pkglnk.dev/pkg/runtime-preset)

Dependencies (1)

README

Runtime Preset

openupm

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 ApplyTo or TryApplyTo methods
  • 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 Preset editor, 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 GetComponent when 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 Apply method
  • Supports automatic application in Awake, OnEnable and Start
  • Runs before other scripts, so that new values from automatically applied presets should be available on your components' Awake, OnEnable and Start methods
  • 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 Assets or Packages folder.

Comments

No comments yet. Be the first!