Skip to content

Instantly share code, notes, and snippets.

View LotteMakesStuff's full-sized avatar
💤
sleepy

LotteMakesStuff LotteMakesStuff

💤
sleepy
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / 0_ReadMe.md
Last active July 9, 2021 19:42
Patreon/Ko-fi -> Monzo feed notification server

This is the Node.js server I wrote to get Patreon and Ko-fi donation notifications streamed into my Monzo bank accounts feed. If you want to run your own instance, this script is designed to be run on Google Firebase Functions so you don't even need to manage a proper server! Deploy this function to firebase and then supply the functions URLs to Patreon/Kofi's webhook APIs, pretty simple!

@LotteMakesStuff
LotteMakesStuff / 1.md
Last active January 5, 2023 20:54
UPM: How to make a custom package

UPM: How to make a custom package So, Unity has this shiny new package manager, and you have code you want to share between projects - wouldn't it be great if we could bundle up our shared code and plug it into all the projects that need it? Let's figure out how to make our own Package!


Todo

  • Modify the project manifest
  • Make a package manifest
  • Package the manifest up with some test code
  • Try it out in Unity!

@LotteMakesStuff
LotteMakesStuff / EditorExtensionMethods.cs
Last active April 28, 2023 09:50
A reimplementation of the logic in the Unity Editor that draws an inspector for a component. We can use this to learn how unity actually draws the inspector. for more info see https://www.patreon.com/posts/16724128
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
public static class EditorExtensionMethods
{
// Public reimplmentation of extention methods and helpers that are marked internal in UnityEditor.dll
@LotteMakesStuff
LotteMakesStuff / PlayerLoop.cs
Last active March 25, 2024 02:38
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;
@LotteMakesStuff
LotteMakesStuff / MinMaxAttribute.cs
Last active March 16, 2023 16:47
MinMax property drawer for Unity - Add a [MinMax] attribute to a property to draw a useful min/max setting slider.
// NOTE DONT put in an editor folder
using UnityEngine;
public class MinMaxAttribute : PropertyAttribute
{
public float MinLimit = 0;
public float MaxLimit = 1;
public bool ShowEditRange;
public bool ShowDebugValues;
@LotteMakesStuff
LotteMakesStuff / DashButton.cs
Created October 31, 2017 22:50
Simple proof of concept editor extention for using amazon dash buttons with Unity
using DashSharp;
using DashSharp.Exceptions;
using DashSharp.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class DashButton : EditorWindow
@LotteMakesStuff
LotteMakesStuff / EditorDispatcher.cs
Last active February 13, 2024 13:22
Allows threaded Unity Editor code to dispatch an action or coroutine to the main thread.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
public static class EditorDispatcher
{
private static readonly Queue<Action> dispatchQueue = new Queue<Action>();
@LotteMakesStuff
LotteMakesStuff / TrafficLightAttribute.cs
Last active February 2, 2024 15:58
TrafficLight control/layout/property drawer: Adds a new editor control that draws lil Traffic Lights in the inspector. its really useful for visualizing state. For example, checkboxes can be hard to read at a glace, but a Red or Green status light is easy! Recommend you use the attached package, as it has all the icon image files.
// Non Editor code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public abstract class TrafficLightAttribute : PropertyAttribute
{
public bool DrawLabel = true;
public string CustomLabel;
public bool AlsoDrawDefault;
@LotteMakesStuff
LotteMakesStuff / StaticCoroutineRunner.cs
Created June 19, 2017 22:32
Ever wanted to run a Unity Coroutine from game code thats not in a MonoBehaviour (for example, a static manager class). Now you can friends!! this class automates creating a dummy game object to run your coroutine and cleans itself up automagically when the routine has finished
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoroutineRunner : MonoBehaviour
{
public static void RunCoroutine(IEnumerator coroutine)
{
var go = new GameObject("runner");
DontDestroyOnLoad(go);
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active May 20, 2022 10:21
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]