Skip to content

Instantly share code, notes, and snippets.

View AnzyGit's full-sized avatar
🍍

Anzy AnzyGit

🍍
  • France
View GitHub Profile
@VictorHHT
VictorHHT / VTMinMaxSlider.cs
Last active March 5, 2023 13:11
Unity MinMaxSlider Property Attribute, with carefully crafted OnGUI drawing to achieve a similar interaction logic like the piano key velocity MinMaxSlider in Apple's GarageBand
using System;
using UnityEditor;
using UnityEngine;
namespace Victor.Tools
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class VTMinMaxSlider : PropertyAttribute
{
internal Vector2 m_MinmaxLimit;
@VictorHHT
VictorHHT / VTRangeStep.cs
Last active April 19, 2024 23:30
Unity Range Step Slider Property Attribute, allow the user to increase a float value or int value by step, like 0.25f or 3 or 100.15f
using System;
using UnityEditor;
using UnityEngine;
// Use Example 1: [VTRangeStep(0f, 10f, 0.25f)]
// Use Example 2: [VTRangeStep(100, 1000, 25)]
namespace Victor.Tools
{
[AttributeUsage(AttributeTargets.Field, Inherited = true, AllowMultiple = false)]
public sealed class VTRangeStep : PropertyAttribute