Skip to content

Instantly share code, notes, and snippets.

View MattRix's full-sized avatar

Matt Rix MattRix

View GitHub Profile
@MattRix
MattRix / Basic.shader
Last active August 29, 2015 14:13
Futile Basic shader rewritten for Unity 5 (no fixed function stuff)
//from http://forum.unity3d.com/threads/68402-Making-a-2D-game-for-iPhone-iPad-and-need-better-performance
Shader "Futile/Basic" //Unlit Transparent Vertex Colored
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
Category
@MattRix
MattRix / ObjectInspector.cs
Last active December 22, 2015 21:48
Easy inspectors on regular monobehaviours etc
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEditor;
using System.Reflection;
[CustomEditor (typeof(UnityEngine.Object),true)]
[CanEditMultipleObjects]
@MattRix
MattRix / IsoSurface.cs
Last active October 12, 2021 02:48
Quick and dirty marching tetraheda isosurface thing
using UnityEngine;
using System.Collections;
using System;
using System.Collections.Generic;
[RequireComponent (typeof(MeshRenderer))]
[RequireComponent (typeof(MeshFilter))]
public class IsoSurface : MonoBehaviour
{
@MattRix
MattRix / DepthShader.shader
Created December 12, 2015 18:29
Basic depth texture rendering
Shader "----------/Edger"
{
SubShader
{
Tags { "RenderType"="Opaque" }
Pass
{
CGPROGRAM
#pragma vertex vert
@MattRix
MattRix / EdgeDetectNormals.shader
Created December 12, 2015 19:22
Unity edge detect normals shader for reference
Shader "Hidden/EdgeDetect" {
Properties {
_MainTex ("Base (RGB)", 2D) = "" {}
}
CGINCLUDE
#include "UnityCG.cginc"
@MattRix
MattRix / FGInspectorManager.cs
Created March 23, 2016 14:13
A crazy thing that lets you rebind which inspectors are used for which objects at any time (ex. on selection change)
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System;
using System.Linq;
using System.Reflection;
using InspectorPair = FGInspectorReflector.InspectorPair;
@MattRix
MattRix / ReadOnlyAttribute.cs
Last active February 20, 2026 18:10
Read Only Attribute for Unity (just mark stuff as [ReadOnly] the same way you would use [HideInInspector])
using UnityEngine;
using System;
using System.Reflection;
using System.Text.RegularExpressions;
[AttributeUsage (AttributeTargets.Field,Inherited = true)]
public class ReadOnlyAttribute : PropertyAttribute {}
#if UNITY_EDITOR
[UnityEditor.CustomPropertyDrawer (typeof(ReadOnlyAttribute))]
@MattRix
MattRix / FilePathAttribute.cs
Created April 4, 2016 19:38
A thing for easily getting paths to assets (use the attribute [FilePath] above a public string property)
using UnityEngine;
using System;
using System.Reflection;
using System.Text.RegularExpressions;
using UnityEditor;
[AttributeUsage (AttributeTargets.Field,Inherited = true)]
public class FilePathAttribute : PropertyAttribute {}
#if UNITY_EDITOR
@MattRix
MattRix / PhysicsFollower.cs
Last active March 22, 2026 05:40
A thing you can use to make a rigidbody move towards a position reliably
using UnityEngine;
using System.Collections;
using System;
[RequireComponent (typeof(Rigidbody))]
public class PhysicsFollower : MonoBehaviour
{
public Transform target;
Rigidbody rb;
@MattRix
MattRix / Shrinkifier.cs
Created April 10, 2016 22:21
Put this on your play area gameobject, and set the pivot to the head transform.
using UnityEngine;
using System.Collections;
public class Shrinkifier : MonoBehaviour
{
public Transform pivot;
public float scale = 1.0f;
void Update ()
{