Skip to content

Instantly share code, notes, and snippets.

View edwardrowe's full-sized avatar

Edward Rowe edwardrowe

View GitHub Profile
@edwardrowe
edwardrowe / CommentComponent.cs
Created April 28, 2021 18:26
Unity CommentComponent
using System.Collections;
using UnityEngine;
/// <summary>
/// Simple component that allows users to write comments to place on MonoBehaviours. Mainly for testmaps.
/// </summary>
public class CommentComponent : MonoBehaviour
{
[TextArea(3, 10)]
[SerializeField]
@edwardrowe
edwardrowe / SelectionHistoryWindow.cs
Created May 12, 2020 13:08
Selection History management window for Unity
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 March 20, 2020 02:17
Extensions to System.Diagnostics's Process class in C#
using System.Diagnostics;
using System.Text;
public static class ProcessExtensions
{
/* Properties ============================================================================================================= */
/* Methods ================================================================================================================ */
/// <summary>
@edwardrowe
edwardrowe / SaveableGUIDImporter.cs
Last active December 2, 2019 20:46
Unity AssetPostProcessor to Identify Duplicate Assets of a Type
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
Last active March 22, 2021 16:12
An example of a Build Tool, used to accompany my blog post on Versioning with git in Unity.
/* MIT License
Copyright (c) 2016 RedBlueGames
*/
using UnityEditor;
using UnityEngine;
using UnityEditor.Build.Reporting;
public class BuildToolExample : MonoBehaviour
{
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 December 7, 2023 03:13
Exposes Git commands to C#, intended for use in Unity as part of a Build Automation tool
/* 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 December 6, 2018 01:00
Tag Navigator for Aseprite
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 October 16, 2018 15:26
UnityTip-Serializing Preferences (10/16/18)
[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 June 17, 2018 00:47
Unity ShaderLab Retro Cutout Lighting Shaders
Shader "RedBlueGames/Lighting/LightMapCutout"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_DarknessColor ("Darkness Color", Color) = (0,0,0.18,.24)
}
SubShader
{