Skip to content

Instantly share code, notes, and snippets.

@ikriz
ikriz / PostBuildTrigger.cs
Created February 21, 2014 21:56
Example PostProcessBuild Script referenced at http://www.ikriz.nl/2012/06/18/unity-post-process-mayhem/
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
public static class PostBuildTrigger
{
private static DirectoryInfo targetdir;
private static string buildname;
private static string buildDataDir;
@rje
rje / gist:11408219
Created April 29, 2014 18:27
audio spectrum code
using UnityEngine;
using System.Collections;
/// <summary>
/// A class for taking spectrum data & calculating the volume of various frequency bands.
///
/// Notes:
/// This doesn't do any smoothing, so wherever you leverage these values you'll probably want to do something.
/// In my project I immediately jump to any higher value, and then have it decay over time at a fixed rate.
/// </summary>
@JosephLaurino
JosephLaurino / OBJ.cs
Created December 5, 2011 19:47
obj file loader for Unity3D
// this code is from http://www.everyday3d.com/blog/index.php/2010/05/24/loading-3d-models-runtime-unity3d/
// which was released under the MIT license
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
public class OBJ : MonoBehaviour {
@Naphier
Naphier / SimpleCSVDebug.cs
Created November 19, 2015 03:11
Simple class to log output to file for debugging.
using System.IO;
using System;
using System.Text;
public class SimpleCSVDebug
{
string GetPathFile()
{
string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
string file = "output.csv";
@fversnel
fversnel / UnitySingleton.cs
Created October 15, 2013 14:13
Singleton implementation from the 'Unite 2013 - Internal Unity Tips and Tricks' talk (http://www.youtube.com/watch?v=Ozc_hXzp_KU)
using UnityEngine;
public class Example : MonoBehaviour
{
public static Example Singleton;
void OnEnable()
{
if (Singleton == null)
Singleton = this;
@ereidland
ereidland / StaticCoroutine.cs
Created December 11, 2013 20:08
Static Coroutine in Unity
using UnityEngine;
using System.Collections;
public class StaticCoroutine : MonoBehaviour
{
private static StaticCoroutine _instance;
public static void Do(IEnumerator enumerator)
{
if (_instance == null)
@drawcode
drawcode / Audio.cs
Created January 6, 2014 08:47
AudioSource
using UnityEngine;
using System.Collections;
public class CSBars : MonoBehaviour {
@stramit
stramit / UnityMethodValidator.cs
Last active June 10, 2019 16:16
Unity Method Validator
//Enable this if you want it to work in NUNIT, see the test example at the bottom
//#define UNIT_TESTING
/**
*
* https://i.imgur.com/GoH9rkv.png
*
* One of the frustrating things about Unity is that there are a spate of magic methods that can be
* called from the runtime. They do not have an interface defined, which by itself is pretty frustrating,
* but it can allow some valid c# that is bad Unity mojo. Consider a private 'OnEnable' function unity
@anotheruiguy
anotheruiguy / node-grunt-sass.md
Last active March 11, 2020 17:07
Set up Node.js, Grunt and Node-Sass from scratch

Run the following steps inside a clean directory

Not sure if you are in the same boat as I, but I could not find any good resource out there that pulled this all together. So here is a step-by-step tutorial for creating a Node.js app from scratch, adding in Grunt and then Node-Sass. Yeah, try and find good docs on Node-Sass alone :(

Hope this is of help!

Create your Node.js project

  • npm init - create a clean node project
  • NOTE: be sure to add "private": true, to the package.json so that your project is not globally distributed as a npm app
@runewake2
runewake2 / CrackedEarthShader.shader
Created April 18, 2018 03:38
Hacked together triplanar shader for custom particle effect in https://youtu.be/FGTpz3O8PnQ
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
Shader "Custom/CrackedEarthShader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_TriPlanarScale ("Triplanar Scale", Float) = 5
_EmissionStrength ("Emission", Float) = 1