Skip to content

Instantly share code, notes, and snippets.

View sebtoun's full-sized avatar

Sebtoun sebtoun

  • Montpellier, FRANCE
View GitHub Profile
@sebtoun
sebtoun / JsonSerialisableScriptableObject.cs
Last active June 16, 2025 07:47
Unity's ScriptableObjects that easily serialize to JSON
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using UnityEngine;
public class JsonSerialisableScriptableObject<T> : ScriptableObject where T : JsonSerialisableScriptableObject<T>
{
@sebtoun
sebtoun / PeriodicTrigger.cs
Created February 24, 2019 20:45
Periodically trigger an event
using System;
public class PeriodicTrigger
{
public event Action TriggerEvent;
private float _period;
private float _remaining;
public PeriodicTrigger( float period )
@sebtoun
sebtoun / ClampedCurveAttribute.cs
Created October 13, 2021 19:04
Unity AnimationCurve decorator to clamp the curve like RangeAttribute is for float.
using UnityEngine;
public class ClampedCurveAttribute : PropertyAttribute
{
public readonly float MinX;
public readonly float MaxX;
public readonly float MinY;
public readonly float MaxY;
public ClampedCurveAttribute( float minX, float maxX, float minY, float maxY )