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!

using System;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMesh : IDisposable
{
public NativeArray<float3> VertexBuffer;
public NativeArray<float3> NormalBuffer;
@LotteMakesStuff
LotteMakesStuff / SegmentFont.cs
Last active May 20, 2022 10:21
a silly 14 segment vector font implementation that outputs text into a unity scene (in 2D) via Debug.DrawLine() calls.
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using UnityEngine;
// Usage Example
// position message string color fontsize
// SegmentFont.Print(new Vector2(0,0), "Message you wanna print", Color.green, 0.2f);
@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")]
@LotteMakesStuff
LotteMakesStuff / PhysicsTool.cs
Created August 26, 2019 01:23
In Unity 2019.1 Unity added a new custom EditorTool API, heres some example code showing some tools we could make with it!
// Put me in an editor folder!
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;
[EditorTool("PhysicsDrop Tool", typeof(Rigidbody))]
public class PhysicsTool : EditorTool
@LotteMakesStuff
LotteMakesStuff / ReadOnlyAttribute.cs
Created January 17, 2017 00:17
ReadOnly property drawer for Unity~ Add a [ReadOnly] attribute to a property to make it show up as read only in the inspector
// NOTE DONT put in an editor folder
using UnityEngine;
public class ReadOnlyAttribute : PropertyAttribute { }
@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 / 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 / StatsBarAttribute.cs
Last active March 24, 2023 16:37
StatsBar property drawer for Unity~ Add a [StatsBar] attribute to a property to make it draw a lil bar, really useful for visualizing character stats like Health or Mana.
// NOTE DONT put in an editor folder
using UnityEngine;
public class StatsBarAttribute : PropertyAttribute
{
public string valueMax;
public StatsBarColor color;
public StatsBarAttribute(string valueMax = null, StatsBarColor color = StatsBarColor.Red)