Skip to content

Instantly share code, notes, and snippets.

View edwardrowe's full-sized avatar

Edward Rowe edwardrowe

View GitHub Profile
@winkels
winkels / CoroutineTimer.cs
Last active May 8, 2017 12:03
Unity script that creates a coroutine-based countdown timer. See http://www.asteroidbase.com/?p=853 for context.
using UnityEngine;
using System.Collections;
[System.Serializable]
public class CoroutineTimer
{
//public fields
public float TimerDuration, TimerRandomScaleFactor, TimerStartDelay;
public bool Repeats;
@FreyaHolmer
FreyaHolmer / ScriptableObjectSpawner.cs
Last active January 8, 2020 06:51
ScriptableObject asset spawner for Unity
// Adds a menu item for easy creation of your ScriptableObject types
// Usage: Right click in project view -> Create -> ScriptableObject... -> Select your type
// It will land in the root of your assets folder with the same name as your class
// Freya Holmér - webmaster@acegikmo.com
using UnityEngine;
using UnityEditor;
using System.Reflection;
using System.Linq;
using System.IO;
@Bradshaw
Bradshaw / VectorExtensions.cs
Last active February 8, 2020 10:50
Quickly convert between various Vector2s and Vector3s
using UnityEngine;
public static class VectorExtensions {
public static Vector2 xy(this Vector3 v3)
{
return new Vector2(v3.x, v3.y);
}
public static Vector2 xz(this Vector3 v3)
{
@hecomi
hecomi / UnityCG.cginc
Created March 16, 2014 09:23
UnityCG.cginc@Unity 4.3.2f1
#ifndef UNITY_CG_INCLUDED
#define UNITY_CG_INCLUDED
#include "UnityShaderVariables.cginc"
#if SHADER_API_FLASH
uniform float4 unity_NPOTScale;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
#endif
public class ReorderableListAttribute : PropertyAttribute {}
@jringrose
jringrose / FindProjectReferences.cs
Last active June 17, 2022 21:34
Unity editor extension that uses spotlight on OSX for lightning fast project reference searches. Asset serialization mode should be set to "Force Text" in the editor settings.
/*
MIT License
Copyright (c) 2016 Jesse Ringrose
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
@Skybladev2
Skybladev2 / ExecutionOrderManager.cs
Last active June 29, 2023 11:20
Explicit script exection order for Unity scripts
using System;
using UnityEditor;
[InitializeOnLoad]
public class ExecutionOrderManager : Editor
{
static ExecutionOrderManager()
{
foreach (MonoScript monoScript in MonoImporter.GetAllRuntimeMonoScripts())
{
// c# companion script
// SpriteUVToShader.cs -------------------------------------------------------------------------------------------------------------------------------- //
// Save you your project, add to your SpriteRenderer gameObject
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[ExecuteInEditMode]
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
using System.Reflection;
[InitializeOnLoad]
public static class ShowFileExtensions
{
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditorInternal;
#endif