Skip to content

Instantly share code, notes, and snippets.

View MattRix's full-sized avatar

Matt Rix MattRix

View GitHub Profile
@munkbusiness
munkbusiness / EmoPacker.cs
Last active May 29, 2024 16:38 — forked from MattRix/EmoPacker.cs
2022 version of the EmoPacker script that creates a image for a TMP sprite asset to use. There is still some wierd issues, with files needing to be exist already, and the TMP asset is updating wierdly. Specifically instead of using metadata it now uses the new spriterects, which is the replacement.
using System.IO;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using TMPro;
using UnityEditor.U2D.Sprites;
public class EmoPacker
{
@WahlbeckUEFN
WahlbeckUEFN / boss_fight.verse
Created May 10, 2023 00:16
Code for boss fight and health bar in UEFN and Verse
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /UnrealEngine.com/Temporary/SpatialMath}
using { /Verse.org/Colors }
@h3r2tic
h3r2tic / raymarch.hlsl
Last active November 14, 2024 18:25
Depth buffer raymarching for contact shadows, SSGI, SSR, etc.
// Copyright (c) 2023 Tomasz Stachowiak
//
// This contribution is dual licensed under EITHER OF
//
// Apache License, Version 2.0, (http://www.apache.org/licenses/LICENSE-2.0)
// MIT license (http://opensource.org/licenses/MIT)
//
// at your option.
#include "/inc/frame_constants.hlsl"
@ChristopherSchubert
ChristopherSchubert / EditorGUIIconGenerator.cs
Last active October 23, 2024 14:33
This script makes using Unity3D EditorGUI icons simple. It should work in any version of the Editor, because it scans the editor for icons rather than hard-coding them. Drop the script in your project, and then navigate to the menu "Tools > EditorGUI Icons > Explore". The UI will show you the icons, let you regex search them, and if you click th…
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using UnityEditor;
using UnityEditor.Experimental;
using UnityEngine;
@mattyellen
mattyellen / UnityAsyncOperationAwaiter.cs
Created July 26, 2020 19:36
Allows the use of async/await (instead of yield) with any Unity AsyncOperation
public static class ExtensionMethods
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp)
{
var tcs = new TaskCompletionSource<object>();
asyncOp.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
}
@AsherVo
AsherVo / RequireReferenceAlert.cs
Last active October 26, 2020 04:03
Using unity's standard ObjectField in RequireReferenceDrawer to fix bugs and improve prefab workflow.
// PLEASE NOTE: This will add ~1sec to your save time
// If that is unacceptable (which it was to me), then you can change all the
// references to "MonoBehaviour" in this file to your own custom behaviour type
// that this script will search through each time you save
using UnityEditor;
using UnityEngine;
using System.Linq;
using System.Reflection;
using System.Collections;
@sinbad
sinbad / SpriteMeshRaycastFilter.cs
Last active May 11, 2023 05:35
SpriteMeshRaycastFilter: easy Unity UI non-rectangular click detector without reading textures
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
// Restrict raycasting to a sprite mesh shape
// Could use Image.alphaHitTestMinimumThreshold to mask but that requires read/write images which can't be packed
[RequireComponent(typeof(Image))]
public class SpriteMeshRaycastFilter : MonoBehaviour, ICanvasRaycastFilter {
private RectTransform rectTransform;
@Split82
Split82 / UnityShadersCheatSheet.shader
Created April 17, 2018 10:07
Unity Shaders Cheat Sheet
Shader "Name" {
Properties {
_Name ("display name", Range (min, max)) = number
_Name ("display name", Float) = number
_Name ("display name", Int) = number
_Name ("display name", Color) = (number,number,number,number)
_Name ("display name", Vector) = (number,number,number,number)
@jiewpeng
jiewpeng / add_anaconda_right_click_menu.md
Last active September 5, 2024 23:03
Add Anaconda Prompt to Windows right click context menu

This gist describes how to add Anaconda Prompt to the Windows right click context menu. This is because at some point, Anaconda no longer adds itself to the PATH after installation.

  1. Run regedit.exe
  2. Navigate to HKEY_CLASSES_ROOT > Directory > Background > shell
  3. Add a key named AnacondaPrompt and set its value to "Anaconda Prompt Here" (or anything you'd like it to appear as in the right click context menu)
  4. Add a key under this key, called command, and set its value to cmd.exe /K C:\Anaconda3\Scripts\activate.bat (may have to change the activate.bat file to whereever Anaconda is installed)
@slembcke
slembcke / CustomProjection.cs
Last active February 7, 2024 11:03
Custom projections for Unity2D games.
using UnityEngine;
using System.Collections;
// This script is meant to be attached to your main camera.
// If you want to use it on more than one camera at a time, it will require
// modifcations due to the Camera.on* delegates in OnEnable()/OnDisable().
[ExecuteInEditMode]
public class CustomProjection : MonoBehaviour {
private void OnEnable(){