This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using UnityEngine; | |
using UnityEditor; | |
public class ListPrefabChanges : EditorWindow | |
{ | |
[MenuItem("Tools/List Prefab Changes")] | |
private static void Command() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class HashableWeakRef<T> : IEquatable<HashableWeakRef<T>> where T : class | |
{ | |
private WeakReference weakRef; | |
public T Target { get { return (T) weakRef.Target; } } | |
public HashableWeakRef(T target) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace TestHashableWeakRef | |
{ | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using IEnumerator=System.Collections.IEnumerator; | |
using System.Collections.Generic; | |
public class TestDependentCoroStop : MonoBehaviour | |
{ | |
[SerializeField] bool runTest = false; | |
void Update() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
using IEnumerator=System.Collections.IEnumerator; | |
public enum CoroStatus | |
{ | |
Running, | |
Suspended, | |
Stopped, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Shitty name generator for your next RPG Character. I have no idea what I'm doing, but Haskell seems pretty fun so far. | |
-- Feels awkward to implement zipWith using this, but I wanted to play around more with partial application | |
multiMap :: [a -> b] -> [a] -> [b] | |
multiMap [] _ = [] | |
multiMap _ [] = [] | |
multiMap (f:fs) (x:xs) = f x:multiMap fs xs | |
-- Redundantly reimplemented zipWith because LYAH told me to | |
zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replace var with type | |
(var)\W+\w+(\W*:)\W*(\w+) | |
Replace function ... eh | |
(function)\W+\w+\W*\(.*\)\W*(:\W*(\w+))? | |
Replace function with return type | |
(function)\W+\w+\W*\(.*\)\W*:\W*(\w+)\W*{ | |
Replace void function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// EppyEditor.PropertyField is supposed to be a replacement for functions like | |
// EditorGUILayout.FloatField and EditorGUILayout.TextField except it handles | |
// multi-object editing correctly without the programmer having to think about | |
// it, and chooses the correct GUI function based on the type paramter 'T'. | |
// | |
// This is different from EditorGUILayout.PropertyField in that (A) you get the | |
// result back, (B) it doesn't print a label automatically (doable already with | |
// propertyfield, but not if you want it to return an exact type) and (C) it allows | |
// you to pass in different function refs to tweak how it works. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class AngryCoroutine : MonoBehaviour | |
{ | |
IEnumerator Start() | |
{ | |
while (false) { | |
yield return null; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from assembly in AppDomain.CurrentDomain.GetAssemblies() | |
#if TEST | |
let typeList = | |
(new Func<Type[]>(() => { | |
Type[] result = null; | |
try { | |
result = assembly.GetTypes(); | |
} catch (ReflectionTypeLoadException) { | |
if (assembly.FullName.StartsWith("MonoDevelop.NUnit")) { | |
// the MonoDevelop.NUnit assembly is screwed up |
OlderNewer