This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////// | |
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////////////////////////////////////////////// | |
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Text; | |
using UnityEditor; | |
using UnityEditor.Experimental; | |
using UnityEngine; | |
public static class LibraryPathsForAsset { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent( typeof(Camera) )] | |
public class FlyCamera : MonoBehaviour { | |
public float acceleration = 50; // how fast you accelerate | |
public float accSprintMultiplier = 4; // how much faster you go when "sprinting" | |
public float lookSensitivity = 1; // mouse look sensitivity | |
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input | |
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MathWishlist { | |
// Mathf | |
public const float TAU = 6.28318530717959f; | |
public static float Frac( float x ) => x - Mathf.Floor( x ); | |
public static float Smooth01(float x) => x * x * (3 - 2 * x); | |
public static float InverseLerpUnclamped( float a, float b, float value) => (value - a) / (b - a); | |
public static float Remap(float iMin, float iMax, float oMin, float oMax, float value) { | |
float t = Mathf.InverseLerp(iMin, iMax, value); | |
return Mathf.Lerp( oMin, oMax, t ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class LengthTable { | |
public float[] distances; | |
int SmpCount => distances.Length; | |
float TotalLength => distances[SmpCount - 1]; | |
public LengthTable( OrientedCubicBezier3D bezier, int precision = 16 ) { | |
distances = new float[precision]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEditor; | |
using System; | |
public static class IMGUIDebugger { | |
static Type type = Type.GetType( "UnityEditor.GUIViewDebuggerWindow,UnityEditor" ); | |
[MenuItem( "Window/IMGUI Debugger" )] | |
public static void Open() => EditorWindow.GetWindow( type ).Show(); | |
NewerOlder