Skip to content

Instantly share code, notes, and snippets.

Avatar

Edward Rowe edwardrowe

View GitHub Profile
@edwardrowe
edwardrowe / SelectionHistoryWindow.cs
Created May 12, 2020
Selection History management window for Unity
View SelectionHistoryWindow.cs
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>
/// Selection history window watches the selection and adds Forward and Back buttons to navigate previous selections.
/// </summary>
public class SelectionHistoryWindow : EditorWindow, IHasCustomMenu
{
@edwardrowe
edwardrowe / ProcessExtensions.cs
Created Mar 20, 2020
Extensions to System.Diagnostics's Process class in C#
View ProcessExtensions.cs
using System.Diagnostics;
using System.Text;
public static class ProcessExtensions
{
/* Properties ============================================================================================================= */
/* Methods ================================================================================================================ */
/// <summary>
@edwardrowe
edwardrowe / SaveableGUIDImporter.cs
Last active Dec 2, 2019
Unity AssetPostProcessor to Identify Duplicate Assets of a Type
View SaveableGUIDImporter.cs
using System.Collections.Generic;
using RedBlueGames.Tools.SaveGame;
using UnityEngine;
using UnityEditor;
/// <summary>
/// Assign new SavableGUIDs when they are imported
/// </summary>
public class SaveableGUIDImporter : AssetPostprocessor
{
@edwardrowe
edwardrowe / BuildToolExample.cs
Created Sep 10, 2019
An example of a Build Tool, used to accompany my blog post on Versioning with git in Unity.
View BuildToolExample.cs
using UnityEditor;
using UnityEngine;
using UnityEditor.Build.Reporting;
public class BuildToolExample : MonoBehaviour
{
[MenuItem("Build/Build with Version")]
public static void MyBuild()
{
// This gets the Build Version from Git via the `git describe` command
View TextTyper_ExampleForCV.cs
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using RedBlueGames.Tools.TextTyper;
public class CVExample : MonoBehaviour
{
[SerializeField]
private InputField textInputField;
@edwardrowe
edwardrowe / Git.cs
Last active Aug 19, 2020
Exposes Git commands to C#, intended for use in Unity as part of a Build Automation tool
View Git.cs
/* MIT License
Copyright (c) 2016 RedBlueGames
Code written by Doug Cox
*/
using System;
using UnityEngine;
/// <summary>
/// GitException includes the error output from a Git.Run() command as well as the
@edwardrowe
edwardrowe / HeroTagNavigator.lua
Last active Dec 6, 2018
Tag Navigator for Aseprite
View HeroTagNavigator.lua
local dlg = Dialog("Hero Tag Navigator")
dlg
:separator{text="Core Animations"}
:button{ text="Idle", onclick=function() selectStartingFrameForTag("IdleLoop_D") end}
:button{ text="Move", onclick=function() selectStartingFrameForTag("MoveLoop_D") end}
:button{ text="Walk", onclick=function() selectStartingFrameForTag("WalkLoop_D") end}
:button{ text="Dash", onclick=function() selectStartingFrameForTag("Dash_D") end}
:button{ text="EdgeJump", onclick=function() selectStartingFrameForTag("EdgeJump_D") end}
:newrow()
:button{ text="Dive", onclick=function() selectStartingFrameForTag("EnterDeepLiquid_D") end}
@edwardrowe
edwardrowe / MyEditorToolPreferences.cs
Created Oct 16, 2018
UnityTip-Serializing Preferences (10/16/18)
View MyEditorToolPreferences.cs
[System.Serializable]
private struct MyEditorToolPreferences
{
// Private fields with the SerializeField attribute will be saved
[SerializeField]
private int savedInt;
// Public fields are also serializable (though I prefer private with the attribute)
public bool SavedBool;
@edwardrowe
edwardrowe / LightmapCutout
Last active Jun 17, 2018
Unity ShaderLab Retro Cutout Lighting Shaders
View LightmapCutout
Shader "RedBlueGames/Lighting/LightMapCutout"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_DarknessColor ("Darkness Color", Color) = (0,0,0.18,.24)
}
SubShader
{
@edwardrowe
edwardrowe / Curve.cs
Created Feb 27, 2018
Curve ScriptableObject for Unity
View Curve.cs
using UnityEngine;
/// <summary>
/// Stores a Unity AnimationCurve as an asset
/// </summary>
public class Curve : ScriptableObject
{
[SerializeField]
private AnimationCurve curve;