Skip to content

Instantly share code, notes, and snippets.

View ianwaldrop's full-sized avatar

Ian Waldrop ianwaldrop

  • Sacramento, CA
View GitHub Profile
@ianwaldrop
ianwaldrop / FindAssetsOfType.cs
Last active January 29, 2018 18:53
Editor script to find all project assets of the given type.
public static IEnumerable<T> FindAssetsOfType<T> () where T : UnityEngine.Object
{
return AssetDatabase.FindAssets ("t:" + typeof (T).Name)
.Select (AssetDatabase.GUIDToAssetPath)
.Select ((T)AssetDatabase.LoadMainAssetAtPath);
}
@ianwaldrop
ianwaldrop / ReflectionUtils
Created December 12, 2015 05:15
Provides a set of extension methods to assist in reflection things.
using System;
using System.Linq;
using System.Reflection;
using System.Collections;
using System.Collections.Generic;
/// <summary>
/// Utilties for reflection
/// </summary>
public static class ReflectionUtils
@ianwaldrop
ianwaldrop / new_gist_file_1
Last active August 29, 2015 14:03
Get Properties with Attribute
var props = t.GetProperties().Where(
prop => Attribute.IsDefined(prop, typeof(T)));