Skip to content

Instantly share code, notes, and snippets.


mika unitycoder

View GitHub Profile
unitycoder / UnityUtils.cs
Created Apr 14, 2021 — forked from stonstad/UnityUtils.cs
Locate Unity Assets Which Contain Broken References
View UnityUtils.cs
using System;
using System.IO;
using UnityEditor;
using UnityEngine;
using System.Linq;
using System.Threading.Tasks;
public class UnityUtils: MonoBehaviour
[MenuItem("Tools/Find Broken GUIDs")]
unitycoder / CornerCheat.cs
Created Apr 7, 2021 — forked from grapefrukt/CornerCheat.cs
Makes a CircleCollider2D slide smoothly along the inner edge of a rounded EdgeCollider2D
View CornerCheat.cs
using UnityEngine;
public class CornerCheat : MonoBehaviour {
public CircleCollider2D circle;
public Rigidbody2D body;
EdgeCollider2D edge;
[Range(0, .2f)] public float distanceThreshold = .03f;
[Range(0, 1)] public float dotThreshold = .96f;
unitycoder / webglcompress.bat
Last active Apr 7, 2021
Unity Compress WebGL Build Manually from Commandline (Brotli)
View webglcompress.bat
echo off
REM add egg path
set PYTHONPATH=D:/Program Files/Unity2019_4/Editor/Data/PlaybackEngines/WebGLSupport/BuildTools/Brotli/dist/Brotli-0.4.0-py2.7-win-amd64.egg
REM rename uncompressed data files (because brotli cannot overwrite same file that its packing)
move /Y "F:\Your\Project\Build\uncompressed.wasm.framework.unityweb" "F:\Your\Project\Build\uncompressed.wasm.framework.unityweb2"
move /Y "F:\Your\Project\Build\uncompressed.wasm.code.unityweb" "F:\Your\Project\Build\uncompressed.wasm.code.unityweb2"
move /Y "F:\Your\Project\Build\" "F:\Your\Project\Build\"
REM compress
unitycoder / Bake Vertex Color Map.shader
Created Apr 6, 2021
bake vertex color from mesh to texture
View Bake Vertex Color Map.shader
Shader "Bake Vertex Color Map"
ZTest Off
ZWrite Off
Cull Off
unitycoder /
Last active Apr 6, 2021
unity openxr notes and tips
View RtpPacket.cs
// ffplay rtp://
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using UnityEngine;
public static class RtpPacket
unitycoder / GPU Compute Model
Last active Mar 29, 2021
GPU Compute Model Terminology / Quick Reference / CheatSheet
View GPU Compute Model

from Landom Thomas

Compute Abstraction Hierarchy Microsoft HLSL Khronos GLSL Khronos OpenCL C Nvidia,CUDA C AMD,HIP Apple,MSL
Entire Kernel/Shader Compute Space Dispatch Dispatch, Compute Space NDRange, Index Space Grid Grid Grid
Major Compute Group Group, Thread Group Workgroup, Local Workgroup Work-group Block, Thread Block Block Threadgroup
Minor Compute Group (& Device Minor SIMD Unit) Wave Subgroup Sub-group Warp Wavefront, Wave, Warp SIMD-group
Quad Compute Object Quad Wave Subgroup Quad ? Quad Quad Quad-group
Single Compute Object Thread Invocation Work-item Thread Thread Thread
unitycoder / SineWave.cs
Created Mar 26, 2021
OnAudioFilterRead generate sinewave
View SineWave.cs
using UnityEngine;
using System; // Needed for Math
public class SineWave : MonoBehaviour
// un-optimized version
public double frequency = 440;
public double gain = 0.05;
private double increment;
unitycoder / ToggleGoogleVROnOff.cs
Created Mar 22, 2021
toggle between 2d and Google Cardboard (2020 Unity XR)
View ToggleGoogleVROnOff.cs
Coroutine StartVR()
return StartCoroutine(startVRRoutine());
IEnumerator startVRRoutine()
// Add error handlers for both Instance and Manager
var xrManager = XRGeneralSettings.Instance.Manager;
if (!xrManager.isInitializationComplete)
unitycoder / TriangleDebugLines.cs
Created Mar 19, 2021
Draw Debug Lines on Mesh Triangle
View TriangleDebugLines.cs
// related topic
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TriangleDebugLines : MonoBehaviour
void Start()