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 11, 2024 19:37
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()
{
@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 November 9, 2023 08:24
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
*/
@Fewes
Fewes / PixelDot.shader
Last active May 12, 2021 04:38
Renders a screen-aligned, distance-independent, resolution-independent, pixel-perfect quad in Unity. Use it with the built-in quad mesh. You don't have to rotate or scale the mesh renderer, the shader will take care of it.
Shader "FX/PixelDot"
{
Properties
{
[NoScaleOffset] _MainTex ("Texture", 2D) = "white" {}
_Color ("Color", Color) = (1, 1, 1, 1)
_Size ("Pixel Size", Range(1, 64)) = 1
}
SubShader
{
@Refsa
Refsa / GrabScreenFeature.cs
Last active April 9, 2024 13:04
Unity URP custom grab pass
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
public class GrabScreenFeature : ScriptableRendererFeature
{
[System.Serializable]
public class Settings