Skip to content

Instantly share code, notes, and snippets.

@pajama
pajama / WorldNormalFromDepthTexture.shader
Last active March 25, 2022 15:07 — forked from bgolus/WorldNormalFromDepthTexture.shader
updated to support single pass instanced rendering and URP render passes with color buffer
Shader "WorldNormalFromDepthTexture"
{
Properties {
_ScanDistance("Scan Distance", float) = 0
_ScanWidth("Scan Width", float) = 10
_LeadSharp("Leading Edge Sharpness", float) = 10
_LeadColor("Leading Edge Color", Color) = (1, 1, 1, 0)
_MidColor("Mid Color", Color) = (1, 1, 1, 0)
_TrailColor("Trail Color", Color) = (1, 1, 1, 0)
_HBarColor("Horizontal Bar Color", Color) = (0.5, 0.5, 0.5, 0)
@pajama
pajama / ExportLayerPositionsToJSON.jsx
Last active October 2, 2017 18:41
Export Layer Positions To JSON from After Effects
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(i=rep.call(e,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?i+"":"null";case"boolean":case"null":return i+"";case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;u>r;r+=1)f[r]=str(r,i)||"null";return o=0===f.length?"[]":gap?"[\n"+gap+f.join(",\n"+gap)+"\n"+a+"]":"["+f.join(",")+"]",gap=a,o}if(rep&&"object"==typeof rep)for(u=rep.length,r=0;u>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,i),o&&f.push(quote(n)+(gap?
using UnityEditor;
using UnityEngine;
class AddPrefab
{
[MenuItem("KevinIsAwesome/AddPrefabToSelected")]
static void AddPrefabToSelected()
{
Object prefab = AssetDatabase.LoadAssetAtPath("Assets/GameObject.prefab", typeof(GameObject));
@pajama
pajama / PersistentSROptions.cs
Last active November 27, 2017 22:34
[Persistent] attribute that automatically saves/loads properties with PlayerPrefs
using UnityEngine;
using System;
using System.Reflection;
using Helios;
//this creates the [Persistent] attribute that can be applied before a property
[AttributeUsage(AttributeTargets.Property)]
public class PersistentAttribute : Attribute
{
}