Skip to content

Instantly share code, notes, and snippets.

@FreyaHolmer
FreyaHolmer / BlendTest.cs
Created August 11, 2020 13:56
Alpha blending comparisons
// alpha blending test
// more info: https://twitter.com/FreyaHolmer/status/1293163103035817985
// add this script to an object in the scene,
// then edit src and dst to see - will it blend?
using UnityEngine;
[ExecuteAlways]
public class BlendTest : MonoBehaviour {
@FreyaHolmer
FreyaHolmer / SceneViewZAlign.cs
Last active February 28, 2025 03:26
Allows the scene view camera to use Z up/down (be sure to place this script in an Editor/ folder)
// Allows you to change the up vector in the scene view to the Z axis.
// Y-up mode uses Unity's default implementation.
//
// Original code from Akulist on the Unity forums, modified by Freya Holmér:
// • Fixed orbit+RMB zoom not working
// • Toggling will now align the camera immediately to the new up vector
// • When the camera is upside down in Z axis mode, left/right orbit will no longer be mirrored (pls fix this too Unity~)
// • Moved toggle buttons to under the gizmo
// • Fixed broken rotation state when focusing a different window in Unity and coming back to the scene view
//
@FreyaHolmer
FreyaHolmer / AssetCopyUtils.cs
Last active June 12, 2024 07:25
Adds context menu items to assets: Copy/Paste import settings & Copy GUID. Put this script in any Editor/ folder in your project and recompile!
// written by https://github.com/FreyaHolmer so use at your own risk c:
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
/// <summary>Utility functions to copy GUIDs, as well as Copy/Paste import settings</summary>
public static class AssetCopyUtils {
const int CTX_MENU_LOCATION = 70;
@FreyaHolmer
FreyaHolmer / LibraryPathsForAsset.cs
Last active July 30, 2024 08:07 — forked from Unity-Javier/LibraryPathsForAsset.cs
Adds a context menu to assets in the project browser to print the file path location of their imported serialized assets
using System;
using System.IO;
using System.Linq;
using System.Text;
using UnityEditor;
using UnityEditor.Experimental;
using UnityEngine;
public static class LibraryPathsForAsset {
@FreyaHolmer
FreyaHolmer / GpuPrinter.cginc
Last active March 16, 2025 05:51
A unity shader .cginc to draw numbers in the fragment shader - see the first comment below for example usage!
///////////////////////////////////////////////////////////////////////////////
// ABOUT: A unity Shader .cginc to draw numbers in the fragment shader
// AUTHOR: Freya Holmér
// LICENSE: Use for whatever, commercial or otherwise!
// Don't hold me liable for issues though
// But pls credit me if it works super well <3
// LIMITATIONS: There's some precision loss beyond 3 decimal places
// CONTRIBUTORS: yes please! if you know a more precise way to get
// decimal digits then pls lemme know!
// GetDecimalSymbolAt() could use some more love/precision
@FreyaHolmer
FreyaHolmer / Ashl.cs
Created August 17, 2024 00:24
Cursed compute shader issue in unity. Plop Ashl onto a game object, assign the compute shader in the inspector, and watch the console. You might need to save a scene and restart unity to see the red log messages!
////////////////////////////////////////////////////////////
// Ashl.cs
using UnityEditor;
using UnityEngine;
[ExecuteAlways]
public class Ashl : MonoBehaviour { // add this to a game object
public ComputeShader cs; // assign the compute shader in the inspector
private static GraphicsBuffer gpuBuffer;
static uint frameid;
void OnEnable() => SceneView.duringSceneGui += SceneViewOnduringSceneGui;