Skip to content

Instantly share code, notes, and snippets.

View phosphoer's full-sized avatar

David Evans phosphoer

View GitHub Profile
@phosphoer
phosphoer / bing-images.js
Last active August 29, 2015 14:06
Bing Wallpaper Downloader
#!/usr/bin/env node
var http = require('http');
var fs = require('fs');
var homePath = process.env.HOME || process.env.USERPROFILE;
var imagesPath = '/Pictures/bing-wallpapers';
if (!fs.existsSync(homePath + imagesPath))
fs.mkdirSync(homePath + imagesPath);
@phosphoer
phosphoer / DisableMaterialImport.cs
Created June 23, 2017 17:16
Unity Disable Material Import
#if UNITY_EDITOR
using UnityEditor;
public class DisableMaterialImport : AssetPostprocessor
{
public void OnPreprocessModel()
{
ModelImporter modelImporter = (ModelImporter)base.assetImporter;
if (modelImporter != null)
@phosphoer
phosphoer / CurveExample.cs
Created December 4, 2018 19:43
CurveExample.cs
using UnityEngine;
using MinMaxCurve = UnityEngine.ParticleSystem.MinMaxCurve;
public class CurveExample : MonoBehaviour
{
[Range(0, 10)]
public int CurrentLevel = 0;
public int LevelCount = 10;
@phosphoer
phosphoer / Fish.shader
Last active February 26, 2019 02:22
Fish Shader
Shader "Custom/Fish"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Texture", 2D) = "white" {}
_LightRamp ("Light Ramp", 2D) = "white" {}
_VertexColorWeight ("Vertex Color Weight", float) = 1
_FishLength ("Fish Length", float) = 1
_FishFrontOffset ("Fish Front Offset", float) = 0
@phosphoer
phosphoer / TexturePackDefinition.cs
Last active June 21, 2020 08:58
TexturePackDefinition.cs
// The MIT License (MIT)
// Copyright (c) 2019 David Evans @phosphoer
// 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 all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@phosphoer
phosphoer / PostFXBlend.cs
Created March 28, 2018 18:44
Unity PostFX Profile Blending
using UnityEngine;
using UnityEngine.Rendering.PostProcessing;
using System.Collections;
public abstract class PostFXBlend : MonoBehaviour
{
public float FadeInTime = 1.0f;
public float FadeOutTime = 1.0f;
public float BlendWeightDebug;
@phosphoer
phosphoer / EditorSelectionHistory.cs
Last active November 1, 2020 06:41
Selection history for Unity Editor
// The MIT License (MIT)
// Copyright (c) 2020 David Evans @phosphoer
// 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 all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
@phosphoer
phosphoer / AnimatorCallbacks.cs
Created October 26, 2020 22:31
Unity Animator Callbacks
using UnityEngine;
using System.Collections.Generic;
// Provides an interface to register callbacks for Animation Events, given they are named 'OnAnimEvent'
// with a string parameter defining the actual event name.
[RequireComponent(typeof(Animator))]
public class AnimatorCallbacks : MonoBehaviour
{
private Dictionary<string, System.Action> _callbacks = new Dictionary<string, System.Action>();
@phosphoer
phosphoer / CellShadedOutline.shader
Created October 20, 2020 22:52
Outline Shader Example
Shader "Custom/CellShadedOutline"
{
Properties
{
_Color ("Color", Color) = (1,1,1,1)
_OutlineColor ("Outline Color", Color) = (1,1,1,1)
_OutlineThickness ("Outline Thickness", float) = 0.1
_MainTex ("Texture", 2D) = "white" {}
_LightRamp ("Light Ramp", 2D) = "white" {}
_VertexColorWeight ("Vertex Color Weight", float) = 1
@phosphoer
phosphoer / AStar.cs
Created May 13, 2021 20:01
Simple C# AStar
// The MIT License (MIT)
// Copyright (c) 2021 David Evans @phosphoer
// 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 all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN