Skip to content

Instantly share code, notes, and snippets.

💭
sleepy

LotteMakesStuff LotteMakesStuff

💭
sleepy
Block or report user

Report or block LotteMakesStuff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / PhysicsTool.cs
Created Aug 26, 2019
In Unity 2019.1 Unity added a new custom EditorTool API, heres some example code showing some tools we could make with it!
View PhysicsTool.cs
// 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 / LookatTool.cs
Last active Aug 28, 2019
In Unity 2019.1 Unity added a new custom EditorTool API, heres some example code showing some tools we could make with it!
View LookatTool.cs
using UnityEditor;
using UnityEditor.EditorTools;
using UnityEngine;
[EditorTool("LookAt Tool")]
public class LookatTool : EditorTool
{
GUIContent cachedIcon;
// NOTE: as were caching this, unity will serialize it between compiles! so if we want to test out new looks,
@LotteMakesStuff
LotteMakesStuff / LayoutUtils.cs
Last active Aug 24, 2019
Simple tool for importing editor layout files (.wlt files) from the asset folder. this is cool cos you can then share layouts with your team via source control
View LayoutUtils.cs
// put me in an Editor folder
using System.IO;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
public static class LayoutUtils
{
// unity stores layouts in a path referenced in WindowLayout.LayoutsPreferencesPath.
// Unfortunately, thats internal - well just creat the path in the same way they do!
@LotteMakesStuff
LotteMakesStuff / AutohookAttribute.cs
Last active Oct 29, 2019
[Autohook] property drawer for unity - Add this [Autohook] attribute to a property to and the inspector will automagically hook up a valid reference for you if it can find a component attached to the same game object that matches the field you put it on. You can watch a demo of this in action here https://youtu.be/faVt09NGzws <3
View AutohookAttribute.cs
// NOTE DONT put in an editor folder!
using UnityEngine;
public class AutohookAttribute : PropertyAttribute
{
}
View NativeMesh.cs
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 Apr 8, 2019
a silly 14 segment vector font implementation that outputs text into a unity scene (in 2D) via Debug.DrawLine() calls.
View SegmentFont.cs
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 / NativeMeshTest.cs
Created Aug 8, 2018
[NativeCollections] How to copy a regular .C# array into a NativeArray suuuuuper quick using memcpy. its about as fast as its ever gunna get!
View NativeMeshTest.cs
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMeshTest : MonoBehaviour
{
private NativeArray<float3> vertexBuffer;
private Vector3[] vertexArray;
@LotteMakesStuff
LotteMakesStuff / PackageManagerExtentionExample.cs
Last active Feb 8, 2019
As of v1.9.3, Unity has added a simple extention API to the PackageManager UI. This small example shows you how to implment it and add a new window to the package manager. Note: you will need to change to the Staging package repository as time of writing. This code needs to go in an Editor folder
View PackageManagerExtentionExample.cs
using System.Linq;
using UnityEditor;
using UnityEditor.PackageManager.UI;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleEnums;
using PackageInfo = UnityEditor.PackageManager.PackageInfo;
[InitializeOnLoad]
public class PackageManagerExtentionExample : IPackageManagerExtension
@LotteMakesStuff
LotteMakesStuff / 0_ReadMe.md
Last active Aug 1, 2018
Patreon/Ko-fi -> Monzo feed notification server
View 0_ReadMe.md

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!

Buy Me a Coffee at ko-fi.com Become a Patron!

@LotteMakesStuff
LotteMakesStuff / 1.md
Last active Nov 19, 2019
UPM: How to make a custom package
View 1.md

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!

You can’t perform that action at this time.