Skip to content

Instantly share code, notes, and snippets.

@deebrol
deebrol / ShowWhenAttribute.cs
Last active February 25, 2024 23:53
Property Drawer for Unity used to show or hide the Field depending on certain conditions
// DONT PUT IN EDITOR FOLDER
using System;
using UnityEngine;
/// <summary>
/// Attribute used to show or hide the Field depending on certain conditions
/// </summary>
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
public class ShowWhenAttribute : PropertyAttribute {
@deebrol
deebrol / FloatHelper.cs
Last active May 31, 2018 18:18
Range with custom intervals – PropertyDrawer
using System;
namespace Helpers
{
public static class FloatHelper
{
/// <summary>
/// Convert the number to the nearest value of a given multiple.
/// Function from StackOverflow response <see href="https://stackoverflow.com/a/34444056">HERE</see>
/// </summary>