Source file unity-csharp/patterns/feedback-layer/FeedbackPreset.cs from the GDnD code examples. Download raw file
// GDnD wiki example
// Demonstrates: a feedback preset as a ScriptableObject asset. One asset per kind of moment
// (Jump, Land, Light Hit, Heavy Hit), so designers tune feel in the Project window and can keep
// several versions for A/B playtests without touching code.
// Related pages: [[game-feel]], [[state-pattern]], [[unity-scriptableobjects]], [[vfx-shape-and-timing]]
// Unity 6 (6000.x). No packages required.
//
// Setup: Create > Feel > Feedback Preset, then assign the assets to FeedbackPlayer's preset slots.
// Changes made to an asset in Play mode are kept in the Editor, which is what you want when tuning.
using UnityEngine;
namespace GDnD.Patterns.Feedback
{
[CreateAssetMenu(menuName = "Feel/Feedback Preset")]
public class FeedbackPreset : ScriptableObject
{
[Tooltip("Freeze time on impact. 0 = none. A few frames (0.03-0.1 s) suits most hits.")]
[Range(0f, 0.3f)] public float hitStopSeconds = 0f;
[Tooltip("Camera shake strength passed to the Shake event. 0 = none.")]
[Range(0f, 3f)] public float shakeForce = 0f;
[Tooltip("Optional particle burst spawned at the event position.")]
public ParticleSystem particlesPrefab;
[Tooltip("Optional one-shot sound.")]
public AudioClip sound;
}
}