Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@jstine35
jstine35 / SwapEditorShortcutsOnPlayerFocus.cs
Last active January 2, 2025 07:46
Resolves Editor Keyboard Behavior in Unity Player, so your game can handle CTRL and hotkeys without corrupting your scene
// Summary
// Disables Editor Keyboard Behavior when Unity Player has focus, so your game can handle CTRL and
// without corrupting your scene.
//
// Usage
// * Download or copy/paste and attach this component to a scene management object in your scene.
// * Create a new shortcut profile using Edit->Shortcuts (tedious, you need to pretty much click every
// button and remove every keystroke, one by one).
//
// Remarks
@seferciogluecce
seferciogluecce / RotateWithMouse.cs
Last active August 17, 2021 15:22
How To Rotate Camera In X Y Axes In Unity With Mouse Press | Unity 3D Tutorial at https://youtu.be/FIiKuP-9KuY
using UnityEngine;
public class RotateWithMouse : MonoBehaviour
{
public float Speed = 5;
void Update()
{
if(Input.GetMouseButton(0))
using UnityEngine;
using UnityEngine.LowLevel;
using UnityEngine.PlayerLoop;
public static class AddPlayerLoopCallback
{
// Add a callback to the PreUpdate phase
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
static void Setup()
{
using UnityEditor;
using UnityEngine.LowLevel;
using UnityEngine.UIElements;
public class ShowPlayerLoopWindow : EditorWindow
{
[MenuItem("Window/Player Loop")]
static void ShowWindow()
{
var wind = GetWindow<ShowPlayerLoopWindow>(false, "Player Loop");
@alecjacobson
alecjacobson / denoise.sh
Last active May 1, 2025 05:53
Remove background audio noise from a video clip via the command line (using ffmpeg and sox)
#!/bin/bash
if [ -z "$2" ];then
echo 'USAGE:
denoise input.mov output.mov
OR
denoise input.mov output.mov [ambient-noise-start-time] [ambient-noise-duration] [sox-noisered-amount] [sox-norm-param]
Shader "Hidden/JumpFloodOutline"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Tags { "PreviewType" = "Plane" }
Cull Off ZWrite Off ZTest Always
@spajus
spajus / CompileTime.cs
Created July 2, 2020 07:59
Put this into Scripts/Editor and open via Unity menu Kodo Linija > Compile Time
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEditor.SceneManagement;
using UnityEngine;
class CompileTime : EditorWindow {
bool allowProfiler = false;
bool isTrackingTime;
@texone
texone / gist:66a46554a6fbda50ccc9831561e4037f
Created June 19, 2020 06:58 — forked from DuncanF/gist:353509dd397ea5f292fa52d1b9b5133d
Unity lockless (no GPU readback) marching cubes via Graphics.DrawProceduralIndirect - some slight faffing because compute shader must append full triangle (3 verts) at a time to render correctly, but this means the appendbuffer count is 3 times smaller than it needs to be, so we have to invoke a very short compute shader (FixupIndirectArgs) just…
MarchingCubesGPU.cs:
...
// DrawProceduralIndirect
ComputeBuffer argsBuffer;
[StructLayout(LayoutKind.Sequential)]
struct DrawCallArgBuffer
{
public const int size =
sizeof(int) +
sizeof(int) +
@ArieLeo
ArieLeo / StandardReflectionProbe.shader
Created June 11, 2020 13:06 — forked from unitycoder/StandardReflectionProbe.shader
Unity Standard Shader - Accessing BoxProfected Reflection Probe Cubemap
// Moved most of the functions from includes into the shader
// Removed lots of unnecessary stuff (i just want the reflection probe cube)
// Still plenty to cleanup
// NEW: http://forum.unity3d.com/threads/reflection-probes-in-a-custom-surface-shader.378549/#post-2685603
// References (none of the scripts worked..)
// http://forum.unity3d.com/threads/reflection-probes-in-a-custom-surface-shader.378549/
// http://forum.unity3d.com/threads/reflection-probes-in-custom-shader.322562/
// http://forum.unity3d.com/threads/accessing-reflection-probe-cubemaps.307077/
@aholkner
aholkner / InstallUnity.cmd
Last active February 8, 2023 09:06
PowerShell script to install correct version of Unity for a project
@echo off
title Install Unity
echo Just a moment...
powershell -NoProfile -NoLogo -ExecutionPolicy Unrestricted -File PowershellScripts\InstallUnity.ps1 -Project . -Components Windows
pause