Skip to content

Instantly share code, notes, and snippets.

View Invertex's full-sized avatar
👁️‍🗨️
Doing too many things at once

Dabbles in too many things Invertex

👁️‍🗨️
Doing too many things at once
View GitHub Profile
@Invertex
Invertex / StandardShaderDoubleSided.shader
Created March 29, 2025 12:42
Unity Standard Shader that renders with proper double-sided lighting, not just culling disabled. Also uses the proper Standard shader GUI.
Shader "Invertex/Standard Double Sided" {
Properties {
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo", 2D) = "white" {}
_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
_Glossiness("Roughness", Range(0.0, 1.0)) = 0.5
_GlossMapScale("Roughness Scale", Range(0.0, 1.0)) = 1.0
[Enum(Metallic Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
@Wavesonics
Wavesonics / remove-onedrive.ps1
Created June 25, 2024 02:08
A Shell script to remove OneDrive, move files to their proper directories, and fix paths in your registry
# Description:
# This script will remove and disable OneDrive integration.
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\New-FolderForced.psm1
Import-Module -DisableNameChecking $PSScriptRoot\..\lib\take-own.psm1
Write-Output "Kill OneDrive process"
taskkill.exe /F /IM "OneDrive.exe"
taskkill.exe /F /IM "explorer.exe"
@Invertex
Invertex / StreamingAudioPlayer.cs
Last active November 12, 2024 14:12
Unity streaming audio playback example
using System.Collections;
using UnityEngine;
using UnityEngine.Networking;
namespace Invertex.Unity.Audio
{
/// <summary>
/// Component that allows playback of an audio file from a server or locally that begins playing before the file is completely downloaded.
/// </summary>
public class StreamingAudioPlayer : MonoBehaviour
@popcron
popcron / CustomPlayBehaviour.cs
Last active May 26, 2022 01:31
Custom code before play
using System;
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
namespace blablalblalmao
{
[InitializeOnLoad]
@Invertex
Invertex / CustomHoldingInteraction.cs
Last active January 17, 2025 02:57
Unity New Input System custom Hold "Interaction" where the .performed callback is constantly triggered while input is held.
using UnityEngine;
using UnityEngine.InputSystem;
//!!>> This script should NOT be placed in an "Editor" folder. Ideally placed in a "Plugins" folder.
namespace Invertex.UnityInputExtensions.Interactions
{
//https://gist.github.com/Invertex
/// <summary>
/// Custom Hold interaction for New Input System.
/// With this, the .performed callback will be called everytime the Input System updates.
@primaryobjects
primaryobjects / hotspot-keep-alive.ps1
Last active April 2, 2025 02:24
Script to Enable Windows 10 Mobile Hotspot Automatically After Reboot
# https://superuser.com/a/1434648
Add-Type -AssemblyName System.Runtime.WindowsRuntime
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0]
Function Await($WinRtTask, $ResultType) {
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType)
$netTask = $asTask.Invoke($null, @($WinRtTask))
$netTask.Wait(-1) | Out-Null
$netTask.Result
@aras-p
aras-p / DebugNode.hlsl
Created January 3, 2020 10:37
"Print a value" custom function node code for Unity ShaderGraph
// Quick try at doing a "print value" node for Unity ShaderGraph.
// Tested on Unity 2019.2.17 with ShaderGraph 6.9.2.
//
// Use with CustomFunction node, with two inputs:
// - Vector1 Value, the value to display,
// - Vector2 UV, the UVs of area to display at.
// And one output:
// - Vector4 Color, the color.
// Function name is DoDebug.
@HungryProton
HungryProton / shader_cache.gd
Last active February 18, 2025 15:25
Godot shader cache hack
extends Spatial
var _materials := []
var _process_materials := []
var _count := 0
func _ready() -> void:
_find_all_materials("res://")
print(_process_materials)
using UnityEngine;
public class MeshBlit : MonoBehaviour
{
public RenderTexture rt;
public Mesh mesh;
public Material material;
public Vector3 meshPosition = new Vector3(0.5f, 0.5f, -1);
@bgolus
bgolus / StableConstantTextureSize.shader
Created April 6, 2019 18:50
Visually stable constant screen space sized texture shader for Unity
Shader "Unlit/Stable Constant Texture Size"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100