Skip to content

Instantly share code, notes, and snippets.

View binouze's full-sized avatar

Benjamin BOUFFIER binouze

  • Lagoon Software LTD
  • Mauritius
View GitHub Profile
@binouze
binouze / AutoUpdater.cs
Last active June 2, 2023 03:26
Simplest implementation of Android in-app updates for Unity
using System;
using UnityEngine;
public sealed class AutoUpdater : MonoBehaviour
{
private const string AndroidClass = "com.lagoonsoft.AutoUpdater";
#region static Singleton
private static AutoUpdater _instance;
private static AutoUpdater GetInstance()
@binouze
binouze / ConditionalDisplayDrawer.cs
Last active January 23, 2024 06:32
Simple CustomPropertyDrawer to show/hide properties based on an Enum or Boolean value
using System;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
[CustomPropertyDrawer( typeof(TestProp))]
public class TestPropDrawerUIE : PropertyDrawer
@binouze
binouze / SplineUtils.cs
Created September 6, 2024 15:10
Utility script for Unity to get the intersections between a line segment and a SplineContainer.
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Splines;
public static class SplineUtils
{
/// <summary>
/// Retrieve the list of intersections between a Spline and a ray (line segment with a direction and length).
/// </summary>
@binouze
binouze / SpriteAtlasAutoEnable.cs
Created November 22, 2024 09:06
Enabling Unity's SpriteAtlasV2 only when entering play mode to prevent constant sprite packing.
using UnityEditor;
[InitializeOnLoad]
public static class SpriteAtlasAutoEnable
{
private const string cEditorPrefSpriteAtlasAutoEnable = "SpriteAtlasAutoEnable.AutoEnable";
private const string menuName = "Tools/SpriteAtlas AutoEnable/Enabled";
public static bool AutoEnable
{