Skip to content

Instantly share code, notes, and snippets.

@yajh
yajh / SceneSearcher.cs
Created April 14, 2014 01:53
Unity3d asset reference searcher.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.IO;
using System.Collections.Generic;
using System.Linq;
public class SceneSearcher : EditorWindow
{
@michaelbartnett
michaelbartnett / LICENSE.txt
Last active October 17, 2022 10:29
Tuple implementation for use with Unity3d
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@jaredjenkins
jaredjenkins / ConcurrentQueue.cs
Last active November 13, 2017 00:00
Concurrent Queue for Unity
using System;
using System.Collections.Generic;
namespace PlaynomicsPlugin
{
internal class ConcurrentQueue<T>{
private readonly object syncLock = new object();
private Queue<T> queue;
@jmcguirk
jmcguirk / PerformBuild.cs
Created March 8, 2013 01:56
Unity3D Ant Build Configuration
// C# example
using UnityEditor;
using System.IO;
using System.Collections;
using UnityEngine;
using System.Collections.Generic;
class PerformBuild
{
static string[] GetBuildScenes()
using System;
using System.Collections.Generic;
public class GameEvent
{
}
public class EventMessenger
{
@AngryAnt
AngryAnt / EditorWindowExample.cs
Created June 15, 2012 08:30
EditorWindowExample from the Unity Asia Bootcamp 12 talk "Streamlining your Unity editor". A simple node based editor.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorWindowExample : EditorWindow
{
List<Node> nodes = new List<Node> ();
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@AngryAnt
AngryAnt / CustomAnimationEditor.cs
Created February 22, 2012 11:53
An old example of how to easily preview animations on objects in-scene.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
[CustomEditor (typeof (Animation))]
public class CustomAnimationEditor : Editor
{
AnimationClip m_SampleClip;
float m_SampleTime = 0.0f;
@darktable
darktable / MiniJSON.cs
Created November 30, 2011 23:08
Unity3D: MiniJSON Decodes and encodes simple JSON strings. Not intended for use with massive JSON strings, probably < 32k preferred. Handy for parsing JSON from inside Unity3d.
/*
* Copyright (c) 2013 Calvin Rien
*
* Based on the JSON parser by Patrick van Bergen
* http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
*
* Simplified it so that it doesn't throw exceptions
* and can be used in Unity iPhone with maximum code stripping.
*
* Permission is hereby granted, free of charge, to any person obtaining
@jarrettmeyer
jarrettmeyer / ObjectToDictionaryHelper.cs
Created January 27, 2011 15:53
C# convert an object to a dictionary of its properties
public static class ObjectToDictionaryHelper
{
public static IDictionary<string, object> ToDictionary(this object source)
{
return source.ToDictionary<object>();
}
public static IDictionary<string, T> ToDictionary<T>(this object source)
{
if (source == null)