Skip to content

Instantly share code, notes, and snippets.

View bugshake's full-sized avatar

Stijn Raaijmakers bugshake

View GitHub Profile
Shader "Instanced/BushShader" {
Properties{
_MainTex("Albedo (RGB)", 2D) = "white" {}
_Color0("Color0", Color) = (0,0,0,1)
_Color1("Color1", Color) = (1,1,1,1)
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
_FadeStart("Fade start", Float) = 10000.0
_FadeEnd("Fade end", Float) = 11000.0
_WaveAmount("Wave Amount", Float) = 0.1
_WaveSpeed("Wave Speed", Float) = 1.0
@bugshake
bugshake / SortedGizmos.cs
Created September 28, 2018 12:27
Depth sorted Gizmos in the Unity Editor
using System;
using System.Collections.Generic;
using UnityEngine;
public static class SortedGizmos
{
static List<ICommand> commands = new List<ICommand>(1000);
public static Color color { get; set; }
@bugshake
bugshake / Screenshotter.cs
Created February 21, 2018 15:55
Save a screenshot in any resolution from the Unity Editor. Useful for making screenshots higher than your monitor's resolution.
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEditor;
/*
AUTHOR: Stijn Raaijmakers @bugshake
@bugshake
bugshake / ObservableProperty.cs
Created October 2, 2017 18:50
C# Observable Property
// get an event when a property changes
public class ObservableProperty<T>
{
T value;
public delegate void ChangeEvent(T data);
public event ChangeEvent changed;
public ObservableProperty(T initialValue)
{
@bugshake
bugshake / RigidbodyInspector.cs
Created March 3, 2017 12:46
Expose detectCollisions property in Rigidbody component
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Rigidbody))]
public class RigidBodyInspector : Editor
{
public override void OnInspectorGUI()
{
Rigidbody target = (Rigidbody)this.target;
if (DrawDefaultInspector())
@bugshake
bugshake / ReadableID
Created February 22, 2017 15:21
Translate a unique ID into something human readable/recognizable/discernable
public static class ReadableID
{
static readonly string[] syllables = new string[256];
public static void initOnce()
{
string[] consonants = new string[] { "b", "br", "c", "ch", "d", "f", "fr", "g", "h", "j", "k", "kn", "l", "m", "n", "p", "pr", "qu", "r", "s", "st", "sl", "sc", "t", "tr", "v", "w", "x", "z" };
string[] vowels = new string[] { "a", "e", "i", "o", "u", "y", "ae", "ee", "ea", "ai" };
for (int i = 0; i < syllables.Length; ++i)
{
@bugshake
bugshake / MeshInspector.cs
Created September 11, 2016 14:40
Show mesh vertices and normals in sceneview [Unity3D]
// author: Stijn Raaijmakers (@bugshake)
// date: 11 sep 2016
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
/// <summary>Add this component to any GameObject with a MeshFilter, then select it in the editor</summary>
public class MeshInspector : MonoBehaviour