Skip to content

Instantly share code, notes, and snippets.

View blackbret94's full-sized avatar

Bret Black blackbret94

View GitHub Profile
@sinbad
sinbad / MeshRendererSortingEditor.cs
Last active November 3, 2023 14:40
Expose sorting layer in MeshRenderer inspector, for rendering on top of sprites
using UnityEngine;
using UnityEditor;
using System.Linq;
/// This just exposes the Sorting Layer / Order in MeshRenderer since it's there
/// but not displayed in the inspector. Getting MeshRenderer to render in front
/// of a SpriteRenderer is pretty hard without this.
[CustomEditor(typeof(MeshRenderer))]
public class MeshRendererSortingEditor : Editor
{
@tkyaji
tkyaji / UnityAssetBundleBuilder.cs
Last active September 22, 2023 13:51
[Unity] Build Asset Bundle, and upload to AWS-S3
using UnityEngine;
using UnityEngine.Networking;
using UnityEditor;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System;
@Flafla2
Flafla2 / Perlin.cs
Last active April 25, 2024 15:04
Improved Perlin Noise Implementation in C#
public class Perlin {
public static double OctavePerlin(double x, double y, double z, int octaves, double persistence) {
double total = 0;
double frequency = 1;
double amplitude = 1;
for(int i=0;i<octaves;i++) {
total += perlin(x * frequency, y * frequency, z * frequency) * amplitude;
amplitude *= persistence;
@trevordixon
trevordixon / pq.cs
Created April 10, 2014 16:51
C# Priority Queue
using System;
using System.Collections.Generic;
// From http://visualstudiomagazine.com/articles/2012/11/01/priority-queues-with-c.aspx
public class PriorityQueue<T> where T : IComparable<T> {
private List<T> data;
public PriorityQueue() {
this.data = new List<T>();
}
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@JISyed
JISyed / gradually_turn.gml
Created September 5, 2013 04:05
GameMaker script (GML) that makes an object gradually turn towards a target object at the specified speed. A tutorial explaining this code can be found here: http://jibransyed.wordpress.com/2013/09/05/game-maker-gradually-rotating-an-object-towards-a-target/
// gradually_turn.gml
// --------
// Gradually turns an object towards its target
//
// FORMAT:
// gradually_turn(objToTurn, target, turnSpeed, accuracy);
//
// <objToTurn> takes an object
// <target> takes an object
@championofblocks
championofblocks / wav-mp3
Last active May 1, 2024 12:49
Command line bash to convert all wav to mp3
for i in *.wav; do lame -b 320 -h "${i}" "${i%.wav}.mp3"; done
@elpuri
elpuri / gist:3753756
Created September 20, 2012 03:12
A collapsible nested list example in QML
import QtQuick 1.1
Item {
width: 200
height: 300
ListView {
anchors.fill: parent
model: nestedModel
delegate: categoryDelegate
@romannurik
romannurik / button_bar_layout.xml
Created April 10, 2012 04:24
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"