Skip to content

Instantly share code, notes, and snippets.

Matt Rix MattRix

View GitHub Profile
@MattRix
MattRix / BezierLineRenderer.cs
Created Mar 7, 2020
A simple single bezier line graphic with a repeating texture pattern
View BezierLineRenderer.cs
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
[RequireComponent(typeof(CanvasRenderer))]
public class BezierLineRenderer : Graphic
{
public Texture texture;
@MattRix
MattRix / EditorUtils.cs
Created Feb 26, 2020
Tools for forcing Unity to pick up changes to .asset files
View EditorUtils.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Linq;
using System.IO;
public class EditorUtils
{
[MenuItem("CONTEXT/ScriptableObject/Sync")]
@MattRix
MattRix / DrawTile.html
Last active Apr 21, 2020
Simple tool to generate the uints necessary for u8x8 drawtile: https://github.com/olikraus/u8g2/wiki/u8x8reference#drawtile - jsfiddle version: https://jsfiddle.net/hongm3tu/3/
View DrawTile.html
<div id="main"></div>
<br/>
<button id="clear">Clear</button>
<button id="fill">Fill</button>
<button id="load">Load</button>
<br/>
<br/>
<textarea id="output"></textarea>
@MattRix
MattRix / avril14.ino
Created Nov 16, 2019
Avril 14 on the Arduino OPL2
View avril14.ino
#include <SPI.h>
#include <OPL2.h>
#include <midi_instruments.h>
OPL2 opl2;
float tempo = 80;
const int numParts = 3;
int bassNotes[] = {32,36,37,34};
@MattRix
MattRix / EditorZoomer.cs
Created Oct 27, 2019
EditorZoomer - an easy way to do panning and zooming inside Unity Editor IMGUI
View EditorZoomer.cs
using UnityEngine;
using System.Collections;
using System;
//based on the code in this post: http://martinecker.com/martincodes/unity-editor-window-zooming/
//but I changed how the API works and made it much more flexible
//usage: create an EditorZoomer instance wherever you want to use it (it tracks the pan + zoom state)
//in your OnGUI, draw your scrollable content between zoomer.Begin() and zoomer.End();
//you also must offset your content by zoomer.GetContentOffset();
@MattRix
MattRix / EditorZoomArea.cs
Last active Oct 25, 2019
Unity Editor Window Zooming (fixed version of code from http://martinecker.com/martincodes/unity-editor-window-zooming/)
View EditorZoomArea.cs
using UnityEngine;
// Helper Rect extension methods
public static class RectExtensions
{
public static Vector2 TopLeft(this Rect rect)
{
return new Vector2(rect.xMin, rect.yMin);
}
View BackwardEulerController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackwardEulerController : MonoBehaviour
{
public float gain = 200; //200-700;
public float damp = 20; //20-100;
public Transform target = null;
@MattRix
MattRix / EmoPacker.cs
Last active Jan 6, 2019
Packing a folder of images into a sprite atlas for use with TextMeshPro
View EmoPacker.cs
using System.IO;
using System.Text;
using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
@MattRix
MattRix / FancyJonEffect.cs
Created Jun 2, 2018
Same as the other JonEffect but with multiple characters easing in at a time
View FancyJonEffect.cs
using UnityEngine;
using System.Collections;
using TMPro;
public class FancyJonEffect : MonoBehaviour
{
TextMeshProUGUI text;
[Range(0f,1f)]
public float buildInPercent = 0;
@MattRix
MattRix / JonEffect.cs
Created Jun 2, 2018
Thing that makes text scale in on the y-axis.
View JonEffect.cs
using UnityEngine;
using System.Collections;
using TMPro;
public class JonEffect : MonoBehaviour
{
TextMeshProUGUI text;
[Range(0f,1f)]
public float buildInPercent = 0;
You can’t perform that action at this time.