Skip to content

Instantly share code, notes, and snippets.

View forestrf's full-sized avatar

Andrés Leone Gámez forestrf

View GitHub Profile
@HPZ07
HPZ07 / DisableYoutubeScrolling.user.js
Last active April 25, 2025 03:29
Disable YouTube Spacebar Scrolling
// ==UserScript==
// @name Disable YouTube spacebar scrolling
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Disables spacebar scrolling and forces it to pause the video instead
// @author HPZ07
// @match https://www.youtube.com/*
// @grant none
// ==/UserScript==
@builder-main
builder-main / BlenderInstallScript.cs
Last active March 3, 2023 20:12
Blender Script unity Installer
[InitializeOnLoad]
public static class BlenderInstallScript
{
//change this to your own import script
private static string blenderScriptRepo = "https://github.com/builder-main/unity-blender-better-import.git";
private static string blenderScripFileName = "Unity-BlenderToFBX.py";
private static string blenderScriptInstallPath = @"Data\Tools";
private static string backupSuffix = ".back";
static BlenderInstallScript()
@radiatoryang
radiatoryang / BuildWebGLDual.cs
Created December 11, 2022 00:58
Fixed version of Unity WebGL dual build editor script example (https://docs.unity3d.com/2022.2/Documentation/Manual/webgl-texture-compression.html) which lets you make WebGL builds with both DXT and ASTC compressed textures... Don't forget to update your WebGL template HTML too.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using System.IO;
public class BuildWebGLDual
{
[MenuItem("Build/WebGL Dual Build")]
public static void BuildGame()
{
@redglasses67
redglasses67 / DynamicBranchShaderComplex.shader
Created November 6, 2022 15:25
Unity dynamic branch variants complex shader - Sample
Shader "Dynamic Branch Shader Complex"
{
Properties
{
_TexAAA ("Tex AAA", 2D) = "white" {}
_TexBBB ("Tex BBB", 2D) = "white" {}
_TexCCC ("Tex CCC", 2D) = "white" {}
[KeywordEnum(None, AAA, BBB, CCC)] _Var_Test ("Variant Test", Float) = 1
}
@josephan
josephan / CloseActiveWindow.cs
Last active March 26, 2025 00:21
Unity Editor keyboard shortcut to close active undocked window
using UnityEngine;
using UnityEditor;
using System.Reflection;
public static class CloseActiveWindow
{
[MenuItem("Edit/Close Active Window ^w", false, -101)]
public static void CloseWindow()
{
var window = EditorWindow.focusedWindow;
@brihernandez
brihernandez / VectorFuryPlayerInput.cs
Last active April 18, 2022 19:47
Example of how to use the new Input System in Unity. This is how I handled input in Vector Fury.
// This is an example of how to use the new input system in a way that I think is actually
// usable for a production game, and not just rapid prototyping. This is much more stable,
// and because it uses the C# class version of the new Input System it will fail to compile
// if something changes in the input asset, which is a VERY GOOD THING.
using UnityEngine;
public class CameraInput
{
public float Pitch = 0f;
@Refsa
Refsa / BlurEffect.compute
Last active February 17, 2025 22:46
Unity URP custom render feature for UI Blur
#pragma kernel Downscale
#pragma kernel GaussianBlurVertical
#pragma kernel GaussianBlurHorizontal
#pragma kernel BoxBlur
Texture2D<float4> _Source;
RWTexture2D<float4> _Dest;
float _Amount;
float2 _Size;
@brihernandez
brihernandez / ComputeGunLead.cs
Last active June 1, 2021 03:49
Computes a point for a gun to aim at in order to hit a target using linear prediction.
/// <summary>
/// Computes a point for a gun to aim at in order to hit a target using linear prediction.
/// Assumes a bullet with no gravity or drag. I.e. A bullet that maintains a constant
/// velocity after it's been fired.
/// </summary>
public static Vector3 ComputeGunLead(Vector3 targetPos, Vector3 targetVel, Vector3 ownPos, Vector3 ownVel, float muzzleVelocity)
{
// Extremely low muzzle velocities are unlikely to ever hit. This also prevents a
// possible division by zero if the muzzle velocity is zero for whatever reason.
if (muzzleVelocity < 1f)

NSP Update Patcher

Instructions:

  1. Place your base NSP, update NSP, and prod.keys into a new folder
  2. Open a terminal and cd into this folder
  3. Download and run script:
curl -o nsp_update_patcher.sh https://gist.githubusercontent.com/willfaust/fb90dec409b8918290012031f09a78ef/raw/9abf2e1b020203aec0051fad99524f8269cb1edd/nsp_update_patcher.sh && chmod +x nsp_update_patcher.sh && ./nsp_update_patcher.sh
@unitycoder
unitycoder / PhotoshopMathFP.hlsl
Created November 9, 2020 08:13
PhotoshopMath hlsl shader
// https://mouaif.wordpress.com/2009/01/05/photoshop-math-with-glsl-shaders/
/*
** Photoshop & misc math
** Blending modes, RGB/HSL/Contrast/Desaturate
**
** Romain Dura | Romz
** Blog: http://blog.mouaif.org
** Post: http://blog.mouaif.org/?p=94
*/