Skip to content

Instantly share code, notes, and snippets.

@MrMatthias
MrMatthias / HKWorkoutActivityType Dictionary
Last active December 7, 2018 11:11
Dictionary of HKWorkoutActivityType names
struct WorkoutActivityType {
let raw:UInt
let name:String
let deprecated:Bool
}
let workoutTypes:[UInt:WorkoutActivityType] = [1: WorkoutActivityType(raw:1, name: "American Football", deprecated: false),
2: WorkoutActivityType(raw:2, name: "Archery", deprecated: false),
3: WorkoutActivityType(raw:3, name: "Australian Football", deprecated: false),
4: WorkoutActivityType(raw:4, name: "Badminton", deprecated: false),
@MrMatthias
MrMatthias / FaceCamera.cs
Created October 2, 2016 15:34
Unity face camera, keep up direction
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class FaceCamera : MonoBehaviour
{
public bool faceCameraActive = true;
public Camera targetCamera;
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor (typeof(UIInspect))]
public class UIInspectEditor : Editor
{
public override void OnInspectorGUI ()
{
@MrMatthias
MrMatthias / ShadowBG.cs
Created January 17, 2016 18:25
unity ui shadow box gallery
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class ShadowBG : MonoBehaviour
{
protected Image image;
public float fadeTime = 2.0f;
protected float currentTime = 0.0f;
@MrMatthias
MrMatthias / gist:6e79edefaa46a9649244
Created August 27, 2015 18:39
UnityEditor load and instantiate prefab
GameObject {prefabName} = AssetDatabase.LoadAssetAtPath<GameObject> ("Assets/{path}/{name}.prefab");
GameObject {name} = PrefabUtility.InstantiatePrefab ({prefabName}) as GameObject;
using UnityEngine;
public class EnumFlagAttribute : PropertyAttribute
{
public string enumName;
public EnumFlagAttribute() {}
public EnumFlagAttribute(string name)
{