Skip to content

Instantly share code, notes, and snippets.

Andrew Wang andyman

Block or report user

Report or block andyman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View AutoSaveOnPlay.cs
// Place inside your Editor folder inside of Assets for it to save the current scene(s) when you run.
// The folder must be called "Editor", but can be nested within something else, e.g. Scripts/Editor
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
@andyman
andyman / AutoSaveOnPlay.cs
Created Mar 1, 2018
Automatically save the Unity scene when pressing play.
View AutoSaveOnPlay.cs
// Place inside your Editor folder inside of Assets for it to save the current scene(s) when you run.
// The folder must be called "Editor", but can be nested within something else, e.g. Scripts/Editor
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEditor.SceneManagement;
@andyman
andyman / pumpkin-chickpea-vegan-pizza.txt
Last active Oct 28, 2017
Pumpkin Chickpea Vegan Pizza Recipe v1.0.1
View pumpkin-chickpea-vegan-pizza.txt
Pumpkin Chickpea No-Knead Vegan Recipe
Makes 2 very filling 12-inch pizzas.
The vegan pizza ends up with a crispy style crust with a very filling protein-filled semi-sweet pumpkin/chickpea topping. Virgin coconut oil adds a surprising and creamy taste while the red bell peppers give a nod to more traditional pizzas.
I came up with this alternative-pizza recipe because I'm vegan (no animal products), and also have a conditional called Interstitial Cystitis (acidic/spicy/soy foods like tomato sauce, onions, and black pepper cause me pain and discomfort), and it's almost Halloween, and had a terrible vegan-pizza craving. If you don't have Interstitial Cystitis, then I'd recommend also adding onion and black pepper for additional taste.
This recipe has a simple mess-free no-knead dough that can be pre-made in bulk and refrigerated ahead of time for a week or two.
No-knead Crust/Dough Recipe
@andyman
andyman / NormalTextureTextureProcessor.cs
Created Jan 20, 2017
Converts textures that end in _n or _normal to normal textures. Add this to your /Editor folder.
View NormalTextureTextureProcessor.cs
using UnityEditor;
using UnityEngine;
using System.Collections;
public class NormalTextureTextureProcessor : AssetPostprocessor {
void OnPostprocessTexture(Texture2D texture) {
string lowerCaseAssetPath = assetPath.ToLower();
if (lowerCaseAssetPath.IndexOf("_n.") >= 0
@andyman
andyman / DontImportMaterials.cs
Created Jan 20, 2017
Add this to your /Editor folder in Unity to avoid importing materials for meshes.
View DontImportMaterials.cs
using UnityEditor;
public class DontImportMaterials : AssetPostprocessor
{
public void OnPreprocessModel()
{
ModelImporter modelImporter = (ModelImporter) assetImporter;
modelImporter.importMaterials = false;
}
}
@andyman
andyman / TiltSingleBehaviour.cs
Created Jan 20, 2017
Simple state machine behaviour to randomize an animator parameter at interval.
View TiltSingleBehaviour.cs
using UnityEngine;
using System.Collections;
public class TiltSingleBehaviour : StateMachineBehaviour {
public string xParameter = "tiltX";
public float minInterval = 1.0f;
public float maxInterval = 4.0f;
public float minValue = -1f;
@andyman
andyman / TiltBehaviour.cs
Created Jan 20, 2017
A simple state machine behaviour to randomly set two animator parameters at interval.
View TiltBehaviour.cs
using UnityEngine;
using System.Collections;
public class TiltBehaviour : StateMachineBehaviour {
public string xParameter = "tiltX";
public string yParameter = "tiltY";
public float minInterval = 1.0f;
public float maxInterval = 4.0f;
@andyman
andyman / LayerMaskUtil.cs
Created Jan 20, 2017
A simple Layer Mask Utility class for Unity for checking whether a layer is in a layermask
View LayerMaskUtil.cs
using UnityEngine;
using System.Collections;
public class LayerMaskUtil {
public static bool CheckLayer(int layer, LayerMask layerMask)
{
return (layerMask.value & (1 << layer)) != 0;
}
}
@andyman
andyman / WebLocationChecker.cs
Created Mar 25, 2016
WebLocationChecker.cs
View WebLocationChecker.cs
using UnityEngine;
using System.Collections;
using System.Text;
/**
* WebLocationChecker by @andyman404
* Licensed under Creative Commons Zero (do with it as you want, no credit needed)
* https://creativecommons.org/publicdomain/zero/1.0/
*
* This script site-locks your Unity Webplayer/WebGL build.
@andyman
andyman / convert_to_gif.sh
Created Sep 12, 2015
Converts a video file to a gif. Needs ffmpeg.
View convert_to_gif.sh
#!/bin/bash
echo "USAGE"
echo "convert_to_gif.sh <video_file_name> <frames_per_second> <width> <start_second> <duration>"
echo "--------------------"
# from here:
# http://superuser.com/questions/556029/how-do-i-convert-a-video-to-gif-using-ffmpeg-with-reasonable-quality
INPUT_FILE=$1
You can’t perform that action at this time.