Skip to content

Huchell/custom-duration-attribute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

com.huchell.unity.custom-duration-attribute

A custom property drawer for displaying a duration in the Unity3d editor

Usage

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;
}

About

A custom property drawer for displaying a duration in the Unity3d editor

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages