Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
✅
‏‏‎

mika unitycoder

✅
‏‏‎
View GitHub Profile
using System.Collections.Generic;
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Profiling;
using UnityEngine;
using UnityEditor;
using UnityEngine.Rendering;
@unitycoder
unitycoder / GetAudioClip.cs
Created November 20, 2019 11:50
Audio Waveform to Texture (Unity)
IEnumerator GetAudioClip()
{
var path = "file://" + SongData.fileName;
// Start downloading
using (var download = new WWW(path))
{
GameObject.Find("waveform").GetComponent<RectTransform>().localScale = new Vector2(0,0);
// Wait for download to finish
@unitycoder
unitycoder / opencv.txt
Created November 19, 2019 09:08
Unity OpenCV notes
// detect face landmark points.
OpenCVForUnityUtils.SetImage(faceLandmarkDetector, rgbaMat);
for (int i = 0; i < trackedRects.Count; i++)
{
List<Vector2> points = faceLandmarkDetector.DetectLandmark(rect);
List<Vector2> pointss = new List<Vector2>();
//Draw Contours
List<Point> pointsss = OpenCVForUnityUtils.ConvertVector2ListToPointList(pointss);
MatOfPoint hullPointMat = new MatOfPoint();
hullPointMat.fromList(pointsss);
@unitycoder
unitycoder / windows10.txt
Last active November 17, 2020 09:53
Windows 10 Tips Notes
// remove items from start menu (didnt work?)
delete from here C:\ProgramData\Microsoft\Windows\Start Menu\Programs
// cleanup context menu
- https://www.ghacks.net/2017/07/09/remove-windows-10-context-menu-bloat/
- Computer\HKEY_CLASSES_ROOT\Directory\Background\shellex\ContextMenuHandlers\
- can remove others than New and WorkFolders
https://appuals.com/fix-slow-context-menus-windows-10-anniversary-update/
also visual studio context menu
- https://developercommunity.visualstudio.com/content/problem/26397/disable-context-menu-for-open-in-visual-studio.html
@unitycoder
unitycoder / unity-premium-player.js
Created November 13, 2019 08:53
Unity Learn Premium Custom Video Player Div Draggable Resizable (Javascript)
// USAGE: copy paste this whole thing into Browser Console window (use F12 to open it)
// Custom video Player Floating Div For Unity Learn Premium v1.0
// main div
var mainDiv = document.createElement('div');
mainDiv.style.backgroundColor = 'black';
mainDiv.style.minWidth = "420px";
mainDiv.style.minHeight = "300px";
mainDiv.style.position = "absolute";
mainDiv.style.zIndex = "100000";
@unitycoder
unitycoder / raycast-lines.cs
Created November 12, 2019 12:00
raycast from edge to edge of box
using UnityEngine;
public class RayMonster : MonoBehaviour
{
public LayerMask layerMask;
int rayCount = 20;
RaycastHit hit;
float boxWidth;
@unitycoder
unitycoder / debugger.shader
Created November 10, 2019 19:16
Shader Debugger: Draw shader value using Shader
// https://forum.unity.com/threads/how-to-print-shaders-var-please.26052/#post-5160875
Shader "Debugger(Values)"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
}
SubShader
{
Cull Off
@unitycoder
unitycoder / Wireframe2.shader
Last active January 12, 2024 12:39
Wireframe Geometry Shader Unity
// with colors and other options, uses UV now
Shader "Wireframe 2 (Geometry Shader)"
{
Properties
{
_Color ("Outline Color", Color) = (1,1,1,1)
_OutlineWidth ("Outline Width", float) = 0.1
}
SubShader
@unitycoder
unitycoder / sceneoutline-example-fix.shader
Last active November 18, 2019 11:33
Fix Sceneview Outline for Vertex Extrusion Shader using SceneSelectionPass (unity)
// vertex extrude shader example, with sceneviewpass (to fix editor outline)
// https://forum.unity.com/threads/scene-outline-bug-or-feature-change-doesnt-follow-shader-extruded-vertices.770273/#post-5149322
Shader "Unlit/vertexextrude"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_Amount("Extrusion Amount", Range(-1,1)) = 0.5
}
@unitycoder
unitycoder / Unity Pixel Art Tilemap Issues.md
Last active January 11, 2026 19:56
Unity Pixel Art Tilemap Issues Gaps Lines Tearing

lines between tiles, tilemap gaps: