Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / CornerCheat.cs
Created April 7, 2021 12:10 — forked from grapefrukt/CornerCheat.cs
Makes a CircleCollider2D slide smoothly along the inner edge of a rounded EdgeCollider2D
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
unitycoder / UnityUtils.cs
Created April 14, 2021 09:04 — forked from stonstad/UnityUtils.cs
Locate Unity Assets Which Contain Broken References
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
unitycoder / CustomParticleCulling.cs
Created April 30, 2021 07:30 — forked from karljj1/CustomParticleCulling.cs
Custom particle culling
using UnityEngine;
public class CustomParticleCulling : MonoBehaviour
{
public float cullingRadius = 10;
public ParticleSystem target;
CullingGroup m_CullingGroup;
Renderer[] m_ParticleRenderers;
@unitycoder
unitycoder / CurvatureImageEffect.shader
Created April 30, 2021 11:49 — forked from MattRix/CurvatureImageEffect.shader
Cavity/Curvature image effect shader based on the Blender node graph in this post: https://blender.community/c/rightclickselect/J9bbbc/
Shader "Milkbag/CurvatureImageEffect"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_LightStrength ("LightStrength", Float) = 0.3
_DarkStrength ("DarkStrength", Float) = 0.3
_Spread ("Spread", Float) = 1.0
[Toggle(USE_MULTIPLY)] _UseMultiply("Use Multiply", Float) = 0
[Toggle(CURVATURE_ONLY)] _CurvatureOnly("Curvature Only", Float) = 0
@unitycoder
unitycoder / FullScreenQuad.shader
Created May 30, 2021 08:37 — forked from jcowles/FullScreenQuad.shader
Make a standard Unity Quad full-screen, purely in the shader
//
// 1. Add a Quad in Unity
// 2. Parent the quad under camera, to prevent frustum culling.
// 3. Attach this shader.
//
Shader "Quad/Fullscreen"
{
Properties
{
}
@unitycoder
unitycoder / ExtractTarGz.cs
Last active June 4, 2021 08:44 — forked from Su-s/ExtractTarGz.cs
Use pure C# to extract .tar and .tar.gz files (with hardcoded extract only these folders)
// source https://gist.github.com/Su-s/438be493ae692318c73e30367cbc5c2a
using System;
using System.IO;
using System.IO.Compression;
using System.Text;
namespace TarLib
{
public class Tar
@unitycoder
unitycoder / BuildDisplayer.cs
Created August 4, 2021 10:35 — forked from llamacademy/BuildDisplayer.cs
Build Incrementor Scripts from https://www.youtube.com/watch?v=PbFE0m9UMtE. If you get value from LlamAcademy, consider becoming a Patreon supporter at https://www.patreon.com/llamacademy
using TMPro;
using UnityEngine;
[RequireComponent(typeof(TextMeshProUGUI))]
public class BuildDisplayer : MonoBehaviour
{
private TextMeshProUGUI Text;
private void Awake()
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
/// <summary>
/// A simple free camera to be added to a Unity game object.
///
/// Keys:
Shader "Test/SmoothZoomTexture"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
[KeywordEnum(Basic,Manual,Blend,Compare)]Mode("Mode", Int) = 0
_Blend("Blend", Range(0,1)) = 1
[Header(Mip Map)]
_MipMapMin("MipMap Min", Int) = 4
@unitycoder
unitycoder / Matrix.hlsl
Created September 1, 2021 18:38 — forked from mattatz/Matrix.hlsl
Matrix operations for HLSL
#ifndef __MATRIX_INCLUDED__
#define __MATRIX_INCLUDED__
#define IDENTITY_MATRIX float4x4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)
float4x4 inverse(float4x4 m) {
float n11 = m[0][0], n12 = m[1][0], n13 = m[2][0], n14 = m[3][0];
float n21 = m[0][1], n22 = m[1][1], n23 = m[2][1], n24 = m[3][1];
float n31 = m[0][2], n32 = m[1][2], n33 = m[2][2], n34 = m[3][2];
float n41 = m[0][3], n42 = m[1][3], n43 = m[2][3], n44 = m[3][3];