A custom property drawer for displaying a duration in the Unity3d editor
The TimeUnit passed into the DurationAttribute tells the property drawer which time unti the field should represent. In the example below the value in the durationInSeconds field will be converted to seconds.
using Huchell.Unity;
using UnityEngine;
public class ExampleClass1 : ScriptableObject
{
[SerializedField, Duration(TimeUnit.Second)]
private int durationInSeconds = 500;
[SerializedField, Duration(TimeUnit.Minute)]
private int durationInMinutes = 5;
}