Skip to content

Instantly share code, notes, and snippets.

View BadCoyoteStudios's full-sized avatar

BadCoyoteStudios

View GitHub Profile
@Gutek
Gutek / C# Version Cheat Sheet.md
Last active February 8, 2022 09:33
Short cheat sheet of changes in C# language from version 6 to 9

CS 6

read-only auto properties

Small help with immutable types...

// private readonly int _age;
// public int Age { get { return _age; } }
public int Age { get; }
@mstevenson
mstevenson / PennerEasing.cs
Created December 30, 2018 16:49
Robert Penner's Easing Functions ported to Unity
/**
* PennerEasing
* Calculates a float value between two target values using
* Robert Penner's easing equations for interpolation over a specified duration.
*
* @author Darren David darren-code@lookorfeel.com
* @version 1.0
*
* Credit/Thanks:
* Robert Penner - The easing equations we all know and love
@beardordie
beardordie / SimpleAudioEvent.cs
Last active June 11, 2020 18:53
Simple Audio Event - supports multiple clips per event, pitch and volume variance - with Custom Editor
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.Audio;
/// <summary>
/// This is a template to create a new Simple Audio Event.
/// It supports an array of audio clips, pitch and volume variance,
/// and a custom editor that shows a button to preview a random sound
/// from the array with the selected pitch and volume variance.
@phi-lira
phi-lira / UniversalPipelineTemplateShader.shader
Last active July 17, 2024 10:54
Template shader to use as guide to create Universal Pipeline ready shaders. This shader works with Universal Render Pipeline 7.1.x and above.
// When creating shaders for Universal Render Pipeline you can you the ShaderGraph which is super AWESOME!
// However, if you want to author shaders in shading language you can use this teamplate as a base.
// Please note, this shader does not necessarily match perfomance of the built-in URP Lit shader.
// This shader works with URP 7.1.x and above
Shader "Universal Render Pipeline/Custom/Physically Based Example"
{
Properties
{
// Specular vs Metallic workflow
[HideInInspector] _WorkflowMode("WorkflowMode", Float) = 1.0
@louisvalet
louisvalet / Colors
Last active November 17, 2020 09:35
I heard you needed colors
using UnityEngine;
public static class Colors
{
public static readonly Color AbsoluteZero = new Color32( 0, 72, 186, 255 );
public static readonly Color Acajou = new Color32( 76, 47, 39, 255 );
public static readonly Color AcidGreen = new Color32( 176, 191, 26, 255 );
public static readonly Color Aero = new Color32( 124, 185, 232, 255 );
public static readonly Color AeroBlue = new Color32( 201, 255, 229, 255 );
public static readonly Color AfricanViolet = new Color32( 178, 132, 190, 255 );
@leegrey
leegrey / PixelController.cs
Created June 22, 2017 11:35
A Unity3D class for snapping pixel art to multiples of a whole (design scale) pixel
using UnityEngine;
/*
A Unity3D class for snapping pixel art to multiples of a whole (design scale) pixel
Use in conjunction with an appropriately scaled Otho Camera
License: MIT
Written by Lee Grey (@mothteeth)
*/
/*
Basic Sprite Shader for aligning pixel art to the same grid, based on the Unity Sprite Shader.
Create one Material where you assign the same Pixels Per Unit value you use on your imported Sprites,
then reuse this Material on all appropriate Sprite Renderers.
(As far as I know there's no possiblity to get this value automatically.)
This is not for scaled or rotated artwork. If you need those features, look at low res render textures.
Use this however you want.
@leegrey
leegrey / ProcessTimer.cs
Created February 13, 2017 22:54
A small debug util for timing chunks of code in Unity / C#
using System.Collections.Generic;
using System.Diagnostics;
using Debug = UnityEngine.Debug;
/*
USAGE:
ProcessTimer.Start("unique_process_id");
// do stuff
ProcessTimer.End("unique_process_id", "An optional additional message to display with results");
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
[RequireComponent (typeof(SpriteRenderer))]
public class SpriteAnimator : MonoBehaviour
{
public List<Sprite> frames = new List<Sprite> ();
public float fps = 15;
@mstevenson
mstevenson / SpriteAnimator.cs
Created November 20, 2014 01:11
2D sprite animator for Unity
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
[RequireComponent (typeof(SpriteRenderer))]
public class SpriteAnimator : MonoBehaviour
{
public List<Sprite> frames = new List<Sprite> ();
public float fps = 15;