Skip to content

Instantly share code, notes, and snippets.

View sim2kid's full-sized avatar

Owen Ravelo sim2kid

View GitHub Profile
@sim2kid
sim2kid / HorizontalToVertical.bat
Last active October 6, 2022 22:06
Converts videos from "Original" folder into vertical variants and puts them in "Edited". Works only for 16:9 ratio. Requires FFMPEG.
FOR %%a IN (Original/*.mp4) DO ffmpeg -i ".\Original\%%a" -vf "split[original][copy];[copy]scale=-1:ih*(16/9)*(16/9),crop=w=ih*9/16,gblur=sigma=20[blurred];[blurred][original]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" ".\Edited\%%~na.mp4"
pause
@sim2kid
sim2kid / TrackTrigger.cs
Last active April 5, 2022 07:29
A tool used to make sure TriggerExit is reliably called for a MonoBehavior. This will ensure when a collider is disabled, your exit events still happens outside of it.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
/// <summary>
/// A tool used to make sure TriggerExit is reliably called for a MonoBehavior. This will ensure when a collider is disabled, your exit events still happens outside of it.
/// Just hook in the AddTrigger, FixedUpdate, and RemoveTrigger to your OnTriggerEnter, FixedUpdate, and OnTriggerExit to get started.
/// </summary>
public class TrackTrigger
@sim2kid
sim2kid / StadiaController.cs
Last active March 31, 2024 15:59
Google Stadia Controller Support in Unity's New Input System (1.2+) With full button mapping. Haptics not supported. You should be able to drag and drop this in your project for Stadia controller support
using UnityEditor;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Layouts;
[InputControlLayout(stateType = typeof(StadiaControllerState))]
#if UNITY_EDITOR
[InitializeOnLoad] // Make sure static constructor is called during startup.
#endif
public class StadiaController : Gamepad
@sim2kid
sim2kid / SetVersion.cs
Last active November 20, 2021 13:42
Set Unity Version to GitHub Tag + Number of Commits. Keep this in an editor only folder. Shit+b to enduce in editor. Should run often enough to keep your build up-to-date
using UnityEngine;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using System.Diagnostics;
using System.Text;
using System.IO;
// Will run the script whenever the editor loads
[InitializeOnLoad]
public class SetVersion: IPreprocessBuildWithReport
@sim2kid
sim2kid / ConvertWavToMp3.bat
Last active November 18, 2021 02:00
Converts all wav files in a directory (and sub directory) to MP3 files. This is a destructive process. (Requires FFMPEG)
@echo off
call :treeProcess
goto :eof
:treeProcess
for %%F in (*.wav) DO (
ffmpeg -i "%%F" "%%~nF.mp3"
DEL %%F
@sim2kid
sim2kid / TwoSidedCutOut.shader
Created November 12, 2021 19:08
Two Sided Cutout Shader Unity
Shader "Transparent/TwoSidedCutOut"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader