Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Rix MattRix

View GitHub Profile
@MattRix
MattRix / readme.txt
Created Jul 8, 2021
Cake Monsters (PuzzleScript Script)
View readme.txt
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@MattRix
MattRix / FolderNoteEditor.cs
Last active May 5, 2021
FolderNoteEditor.cs - put notes on any folder in Unity.
View FolderNoteEditor.cs
#if UNITY_EDITOR //this allows the user to put it in a non-editor folder if they want, since it's not accessing anything else
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(DefaultAsset))]
public class FolderNoteEditor : Editor
{
bool isFolder;
string path;
AssetImporter importer;
View FancyColorSwap.shader
Shader "Futile/FancyColorSwap"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_ColorR ("Red Replacement Color", Color) = (1,0,0,1)
_ColorG ("Green Replacement Color", Color) = (0,1,0,1)
_ColorB ("Blue Replacement Color", Color) = (0,0,1,1)
}
@MattRix
MattRix / ColorSwap.shader
Created Mar 16, 2021
ColorSwap for Futile
View ColorSwap.shader
Shader "Futile/ColorSwap"
{
Properties
{
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_ColorR ("Red Replacement Color", Color) = (1,0,0,1)
_ColorG ("Green Replacement Color", Color) = (0,1,0,1)
_ColorB ("Blue Replacement Color", Color) = (0,0,1,1)
}
@MattRix
MattRix / PixImporter.cs
Created Mar 16, 2021
ScriptedImporter custom texture file format example
View PixImporter.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor.AssetImporters;
using System;
using System.IO;
//ScriptedImporter docs: https://docs.unity3d.com/Manual/ScriptedImporters.html
[ScriptedImporter(1, "pix")]
@MattRix
MattRix / FLabel.cs
Created Mar 15, 2021
FLabel with pixel snapping and wrapping
View FLabel.cs
using System;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
//parts of this were inspired by https://github.com/prime31/UIToolkit/blob/master/Assets/Plugins/UIToolkit/UIElements/UIText.cs
public class FLabel : FFacetElementNode
{
public Action SignalTextChange;
View InstancedExample.cs
using UnityEngine;
using System.Collections;
public class InstancedExample : MonoBehaviour
{
public int instanceCount = 1000;
public Mesh instanceMesh;
public Material instanceMaterial;
public int subMeshIndex = 0;
@MattRix
MattRix / CurvatureImageEffect.shader
Last active Apr 30, 2021
Cavity/Curvature image effect shader based on the Blender node graph in this post: https://blender.community/c/rightclickselect/J9bbbc/
View CurvatureImageEffect.shader
Shader "Milkbag/CurvatureImageEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_LightStrength ("LightStrength", Float) = 0.3
_DarkStrength ("DarkStrength", Float) = 0.3
_Spread ("Spread", Float) = 1.0
[Toggle(USE_MULTIPLY)] _UseMultiply("Use Multiply", Float) = 0
[Toggle(CURVATURE_ONLY)] _CurvatureOnly("Curvature Only", Float) = 0
@MattRix
MattRix / cellular_noise.cginc
Created Mar 1, 2021
Worley cellular noise for HLSL (and Unity), translated from from Stefan Gustavson's GLSL version
View cellular_noise.cginc
// Cellular noise ("Worley noise") in 2D in GLSL.
// Copyright (c) Stefan Gustavson 2011-04-19. All rights reserved.
// This code is released under the conditions of the MIT license.
// See LICENSE file for details.
// https://github.com/stegu/webgl-noise
// Modulo 289 without a division (only multiplications)
float3 mod289(float3 x) {
return x - floor(x * (1.0 / 289.0)) * 289.0;
@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;