Skip to content

Instantly share code, notes, and snippets.

using System;
namespace UniRx {
public static class SwitchExtensions {
public static IObservable<OUT> SwitchSelectWhenTrue<OUT>( this IObservable<bool> observable, Func<IObservable<OUT>> resultIfTrue ) {
return observable.Select(value => value == true ? resultIfTrue() : Observable.Empty<OUT>()).Switch();
}
@svermeulen
svermeulen / MultiSceneSetup.cs
Created October 23, 2016 17:32
Simple editor script to save and load multi-scene setups within Unity3D
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEditor.SceneManagement;
using UnityEditor;
using System.Collections;
using System.Linq;
public class MultiSceneSetup : ScriptableObject
{
@hickford
hickford / OrderedDictionary.cs
Created March 11, 2013 20:19
Ordered dictionary class for C# and .NET (an omission from the standard library). A dictionary that remembers the order that keys were first inserted. If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end. See http://stackoverflow.com/questions…
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
/// <summary>
/// A dictionary that remembers the order that keys were first inserted. If a new entry overwrites an existing entry, the original insertion position is left unchanged. Deleting an entry and reinserting it will move it to the end.
/// </summary>
/// <typeparam name="TKey">The type of keys</typeparam>