Skip to content

Instantly share code, notes, and snippets.

@andyrbell
andyrbell / scanner.sh
Last active November 3, 2024 13:42
Make a pdf look scanned using ImageMagick
# use ImageMagick convert
# the order is important. the density argument applies to input.pdf and resize and rotate to output.pdf
convert -density 90 input.pdf -rotate 0.5 -attenuate 0.2 +noise Multiplicative -colorspace Gray output.pdf
/*
Basic Sprite Shader for aligning pixel art to the same grid, based on the Unity Sprite Shader.
Create one Material where you assign the same Pixels Per Unit value you use on your imported Sprites,
then reuse this Material on all appropriate Sprite Renderers.
(You can use Shader.SetGlobalFloat to set that Pixels Per Unit value for all your shaders:
https://docs.unity3d.com/ScriptReference/Shader.SetGlobalFloat.html)
This is not for scaled or rotated artwork. If you need those features, look at low res render textures.
Use this however you want.
@mrcarriere
mrcarriere / StopPlayingOnRecompile.cs
Last active October 11, 2018 16:42
Force Unity to stop playing if you have edited a source file. Helps avoid some editor crashes and false positives / error spam. To use, drop this script in an "Editor" folder in your project.
using UnityEditor;
[InitializeOnLoad]
public class StopPlayingOnRecompile
{
static StopPlayingOnRecompile()
{
AssemblyReloadEvents.beforeAssemblyReload += () =>
{
if (EditorApplication.isPlaying)
using UnityEngine;
using System.Collections;
using UnityEngine.Events;
namespace Cluster {
public class CollisionCall : MonoBehaviour {
public LayerMask layerMask = -1;
@KeyMaster-
KeyMaster- / spriteGlitch.shader
Last active October 8, 2024 13:23
A glitch effect shader for Sprites in Unity3D
//Copyright (c) 2014 Tilman Schmidt (@KeyMaster_)
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions:
//The above copyright notice and this permission notice shall be included in
@MattRix
MattRix / DZMenu.cs
Created April 28, 2014 17:55
Unity menu item to do iOS builds easily (make sure you put it in a folder named "Editor")
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
public class DZMenu
{
[MenuItem ("DiscoZoo/Build for iOS")]
static void BuildForIOS()
{
@jpsarda
jpsarda / TrailPath.cs
Last active December 11, 2023 04:35
Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method. See description and usage in code. https://vine.co/v/MzpwETVAKIT
using UnityEngine;
using System;
using System.Collections.Generic;
/*
*
* Trail FX for Futile 2D engine (Unity3D). Works on any custom node as long as you provide a CreateClone method.
* FSpriteTrail provided as an example.
* https://vine.co/v/MzpwETVAKIT
*
@jpsarda
jpsarda / FPseudoHtmlText.cs
Last active December 21, 2015 09:39
Renders pseudo html code with Futile (Unity2D) 2D game engine. Can render texts but also FSprites and FButtons. Example in the first comments.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Text;
using System.Reflection;
@nornagon
nornagon / atom.coffee
Created November 12, 2011 05:25
Tiny canvas game framework
window.atom = atom = {}
atom.input = {
_bindings: {}
_down: {}
_pressed: {}
_released: []
bind: (key, action) ->
@_bindings[key] = action