Skip to content

Instantly share code, notes, and snippets.

View Eriard's full-sized avatar

Markus Lange Eriard

View GitHub Profile
/*
SpriteAnimator for Unity by Alec Holowka
http://InfiniteAmmo.com - @infinite_ammo
*/
using UnityEngine;
using System.Collections;
public class SpriteAnimator : MonoBehaviour
{
/*
Tween for Unity by Alec Holowka
http://InfiniteAmmo.com - @infinite_ammo
*/
using UnityEngine;
using System.Collections;
public class TweenBase : MonoBehaviour
{
Shader "Sprites/Cutout"
{
Properties
{
[PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
_Color ("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
_Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.5
}
@unitycoder
unitycoder / RotateSpriteTowardsMouse.cs
Last active September 25, 2025 05:23
Rotate sprite towards mouse
// Rotate sprite/object towards mouse
// Reference: http://johnstejskal.com/wp/rotating-objects-and-sprites-in-unity3d-using-cs-c/
// https://forum.unity3d.com/threads/how-to-detect-angle-from-one-object-to-another-in-2d.477510/
// Usage: Attach this script to sprite, use Orthographic camera!
using UnityEngine;
using System.Collections;
public class RotateSpriteTowardsMouse : MonoBehaviour
{
@Fonserbc
Fonserbc / Easing.cs
Last active October 30, 2025 21:21
Compact and simple easing functions for Unity
using UnityEngine;
/*
* Most functions taken from Tween.js - Licensed under the MIT license
* at https://github.com/sole/tween.js
* Quadratic.Bezier by @fonserbc - Licensed under WTFPL license
*/
public delegate float EasingFunction(float k);
public class Easing
@cjddmut
cjddmut / EasingFunctions.cs
Last active May 14, 2026 10:33
Easing Functions for Unity3D
/*
* Created by C.J. Kimberlin
*
* The MIT License (MIT)
*
* Copyright (c) 2019
*
* 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
@vybstat
vybstat / ds_store_removal
Last active September 18, 2025 18:40
How to remove .DS_Store file from GitHub that Mac OS X creates
# remove .DS_Store file from GitHub that MAC OS X creates
# find and remove .DS_Store
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
# create .gitignore file, if needed
touch .gitignore
echo .DS_Store > .gitignore
# push changes to GitHub
// Unity C# Cheat Sheet
// I made these examples for students with prior exerience working with C# and Unity.
// Too much? Try Unity's very good tutorials to get up to speed: https://unity3d.com/learn/tutorials/topics/scripting
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoxMover : MonoBehaviour
{
public enum Slide
{
None,
Perpendicular,
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public float speedX;
public float accelX;
public float decelX;
public float gravity;