Skip to content

Instantly share code, notes, and snippets.

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

mika unitycoder

✅
‏‏‎
View GitHub Profile
@unitycoder
unitycoder / Liquid.shader
Created February 22, 2022 09:54 — forked from josephbk117/Liquid.shader
Unity liquid shader
/*Please do support www.bitshiftprogrammer.com by joining the facebook page : fb.com/BitshiftProgrammer
Legal Stuff:
This code is free to use no restrictions but attribution would be appreciated.
Any damage caused either partly or completly due to usage this stuff is not my responsibility*/
Shader "BitshiftProgrammer/Liquid"
{
Properties
{
_Colour ("Colour", Color) = (1,1,1,1)
_FillAmount ("Fill Amount", Range(-10,10)) = 0.0
@unitycoder
unitycoder / EasingFunctions.cs
Created February 18, 2022 16:14 — forked from cjddmut/EasingFunctions.cs
Easing Functions for Unity3D
/*
* Created by C.J. Kimberlin
*
* The MIT License (MIT)
*
* Copyright (c) 2019
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@unitycoder
unitycoder / GL_DRAW.cs
Created February 14, 2022 15:37
GL_DRAW
// https://github.com/Unity-Technologies/DOTS-training-samples
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GL_DRAW
{
public static float PI2 = Mathf.PI * 2.0f;
static float Z = 0;
@unitycoder
unitycoder / SaveRenderTextures.cs
Created February 12, 2022 19:38
Save a 3D Render Texture to file
// https://forum.unity.com/threads/save-a-3d-render-texture-to-file.1204267/
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor;
 
public class SaveRenderTextures : MonoBehaviour
{
    //define each resolution axis of the volume
    public int voxelSizeWidth;
    public int voxelSizeHeight;
@unitycoder
unitycoder / GetLocalIPAddress.cs
Last active February 15, 2023 11:03
Get Local External IP address
public static string GetLocalIPAddress()
{
var host = Dns.GetHostEntry(Dns.GetHostName());
for (int i = host.AddressList.Length - 1; i > 0; i--)
{
//Debug.Log(host.AddressList[i].ToString());
return host.AddressList[i].ToString();
}
//foreach (var ip in host.AddressList)
@unitycoder
unitycoder / OpenAITest.cs
Last active March 5, 2023 06:32
using open ai API in unity
// more info https://unitycoder.com/blog/2022/02/05/using-open-ai-gpt-3-api-in-unity/
using OpenAI_API;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using UnityEngine;
public class OpenAITest : MonoBehaviour
{
@unitycoder
unitycoder / GeometryUtils.cs
Last active June 23, 2025 16:10
Unity Math & Geometry Utility : ShortestAngleDistance, IsAxisAligned, FindClosestEdge, PointOnOppositeSideOfPolygon, TriangulatePolygon, ClosestTimesOnTwoLines, ClosestPointsOnTwoLineSegments, ClosestPointOnLineSegment, ClosestPolygonApproach, PointInPolygon, ProjectPointOnPlane, OrientedMinimumBoundingBox2D, PolygonsWithinRange, PolygonVertexTo…
// source: https://docs.unity3d.com/Packages/com.unity.xrtools.utils@1.4/api/Unity.XRTools.Utils.GeometryUtils.html
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Unity.XR.CoreUtils
{
/// <summary>
/// Utility methods for common geometric operations
@unitycoder
unitycoder / alwaysontop.au3
Created February 2, 2022 20:15
autoit script, make window stay always on top (win10)
#include <AutoItConstants.au3>
Local $hWnd = WinGetHandle("Alarms & Clock")
WinSetOnTop($hWnd, "", $WINDOWS_ONTOP)
@unitycoder
unitycoder / new-input-system.md
Last active February 23, 2024 11:16
new input system unity
@unitycoder
unitycoder / SpriteShaderNoBanding.shader
Last active January 24, 2022 08:29
unity remove color banding
// https://pixelmager.github.io/linelight/banding
This leads us to the final shader-code, again, for our custom Sprites/Default, both forcing pure blacks/whites by limiting to an rpdf-noise where clamping occours AND increasing noise (but not “too much”):
//note: uniform pdf rand [0;1[
float4 hash43n(float3 p)
{
p = frac(p * float3(5.3987, 5.4421, 6.9371));
p += dot(p.yzx, p.xyz + float3(21.5351, 14.3137, 15.3247));
return frac(float4(p.x * p.y * 95.4307, p.x * p.y * 97.5901, p.x * p.z * 93.8369, p.y * p.z * 91.6931 ));