Skip to content

Instantly share code, notes, and snippets.

View thebeardphantom's full-sized avatar

Mika Notarnicola thebeardphantom

View GitHub Profile
@thebeardphantom
thebeardphantom / AssemblyDefinitionCleanupPostProcessor.cs
Last active March 31, 2024 23:19
Sorts imports of an AssemblyDefinition asset in Unity.
#define POSTPROCESSOR_ENABLED
using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Linq;
using UnityEditor;
using UnityEditorInternal;
using Debug = UnityEngine.Debug;
@thebeardphantom
thebeardphantom / PoissonJob.cs
Created January 29, 2024 09:03
A port of Fast Poisson Disk Sampling for Unity to the Jobs System (https://gist.github.com/a3geek/8532817159b77c727040cf67c92af322)
using System;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using Random = Unity.Mathematics.Random;
/*
* A port of Fast Poisson Disk Sampling for Unity to the Jobs System.
@thebeardphantom
thebeardphantom / CsvDataGenerator.CsvFile.cs
Last active January 27, 2024 11:06
An example of generating ScriptableObjects and populating their serialized properties via CSV files.
using System;
using System.Linq;
using UnityEngine;
public static partial class CsvDataGenerator
{
#region Types
public class CsvFile
{
@thebeardphantom
thebeardphantom / GSheetImporter.cs
Last active October 29, 2023 10:35
Simple .gsheet to TextAsset ScriptedImporter for Unity, with code from https://gist.github.com/jasonleehodges/359eb2af0d1caec0153bb7450c165ffd
[ScriptedImporter(1, "gsheet")]
public class GSheetImporter : ScriptedImporter
{
#region Types
private class WebClientEx : WebClient
{
#region Fields
private readonly CookieContainer _container;
@thebeardphantom
thebeardphantom / BlenderSupportFunctions.cs
Last active September 4, 2023 16:49
Improvements to Unity <-> Blender <-> FBX <-> Blendfile workflows. See readme.txt.
using System;
using System.Diagnostics;
using System.IO;
using Unity.Logging;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEngine;
using Debug = UnityEngine.Debug;
public class BlenderSupportFunctions : AssetPostprocessor
@thebeardphantom
thebeardphantom / AttenuationCurve.cs
Last active June 17, 2022 23:42
AttenuationCurve
using System;
using Unity.Mathematics;
using UnityEngine;
[Serializable]
public struct AttenuationCurve
{
#region Properties
[field: SerializeField]
using System;
using System.Linq;
using UnityEditor;
using UnityEditor.ShortcutManagement;
using UnityEngine;
[InitializeOnLoad]
public class PlayModeShortcutManagerProfileUtility
{
#region Types
@thebeardphantom
thebeardphantom / TaskData.cs
Last active February 16, 2022 10:32
Simple, efficient task scheduler for Unity using SortedSet<T>.
using UnityEngine;
public readonly struct TaskData
{
#region Fields
public readonly double ExecTime;
public readonly double DelayTime;
@thebeardphantom
thebeardphantom / AdvancedDropdownField.cs
Last active January 30, 2022 23:42
A very simple wrapper around IMGUI's AdvancedDropdown for UI Toolkit.
public class AdvancedDropdownField : DropdownField
{
#region Types
private class SimpleAdvancedDropdown : AdvancedDropdown
{
#region Fields
private readonly DropdownField _dropdownField;
@thebeardphantom
thebeardphantom / ILiteEvent.cs
Last active February 12, 2022 23:06
A reimplementation of C# events for Unity 2020+ that's lighter on GC.
using System;
namespace BeardPhantom.LiteEvent
{
public interface ILiteEvent<in TDelegate> where TDelegate : Delegate
{
#region Properties
int ListenerCount { get; }