Skip to content

Instantly share code, notes, and snippets.

View unitycoder's full-sized avatar
‏‏‎

mika unitycoder

‏‏‎
View GitHub Profile
@unitycoder
unitycoder / ProjectionViewer.cs
Created January 1, 2025 21:33 — forked from runevision/ProjectionViewer.cs
Script to create visual illusion of rotating wireframe object that tricks the eye into switching orientation and rotation direction
using UnityEngine;
// Visual effect/illusion where a rotating model alternates between
// seeming to rotate one way around and the other.
// Unlike many similar effects, the eyes are nudged/forced to see it
// in alternating ways by oscillating between regular perspective and
// inverse perspective, changing which parts of the model appear
// bigger or smaller on the screen.
// Attach this script on the GameObject with the Camera component.
@unitycoder
unitycoder / BurstSDFGenerator.cs
Created January 1, 2025 21:33 — forked from runevision/BurstSDFGenerator.cs
Signed Distance Field generator for Unity with Burst support
/*
Based on the Anti-aliased Euclidean distance transform described by Stefan Gustavson and
Robin Strand. For further information, see https://contourtextures.wikidot.com/ and
https://web.archive.org/web/20220503051209/https://weber.itn.liu.se/~stegu/edtaa/
The algorithm is an adapted version of Stefan Gustavson's code, it inherits the copyright
statement below, which applies to this file only.
The rewrite with Unity Burst support makes the execution 40 times faster by default,
and 75 times faster if the passed in textures are both of type TextureFormat.RGBAFloat.
@unitycoder
unitycoder / valheim_plus.cfg
Created December 29, 2024 15:08
valmeim plus mod settings (more drops, bigger inventory etc)
[ValheimPlus]
; Change false to true to enable this section.
enabled = true
; Display the Valheim Plus logo in the main menu
mainMenuLogo = true
; Display the advertisement of our server hosting partner on the server browser menu
serverBrowserAdvertisement = true
@unitycoder
unitycoder / Edge Detection.shader
Created December 20, 2024 18:20
Edge Detection shader
// https://ameye.dev/notes/edge-detection-outlines/
Shader "Custom/Edge Detection"
{
Properties
{
_OutlineThickness ("Outline Thickness", Float) = 1
_OutlineColor ("Outline Color", Color) = (0, 0, 0, 1)
}
SubShader
@unitycoder
unitycoder / win-commandline.md
Created December 19, 2024 08:45
windows cmd prompt commandline batch

install telnet

run as admin> dism /online /Enable-Feature /FeatureName:TelnetClient

@unitycoder
unitycoder / recyclebinsizes.ps1
Created December 17, 2024 13:19
PowerShell: Print out recycle bin sizes per user from C drive
# Prints out recycle bin sizes per user from C drive
# Ensure the script runs as Administrator
$recycleBinPath = "C:\`$Recycle.Bin" # Escape the `$` character
# Check for each user's Recycle Bin folder
Get-ChildItem -LiteralPath $recycleBinPath -Directory -Force | ForEach-Object {
$userSID = $_.Name
try {
# Resolve the SID to a username
@unitycoder
unitycoder / TriangularGridMesh.cs
Created December 15, 2024 20:55
terrain grid mesh generator
// https://discussions.unity.com/t/what-is-the-best-way-to-make-a-map-terrain-for-my-2d-game/1569621/5
using System.Collections.Generic;
using UnityEngine;
[ExecuteInEditMode]
[RequireComponent( typeof(MeshFilter) , typeof(MeshRenderer) )]
public class TriangularGridMesh : MonoBehaviour
{
[Header("Grid Settings")]
[SerializeField] float _gridTriangleLength = 1f;
@unitycoder
unitycoder / MotionFX.cs
Created December 11, 2024 20:17
MotionVector Effect: Object "disappears" when paused
// attach to main camera, BIRP
using UnityEngine;
[ExecuteInEditMode]
public class MotionFX : MonoBehaviour
{
public Material mat;
Camera cam;
@unitycoder
unitycoder / chatbot.py
Created December 2, 2024 22:33
llama-mesh: "Error Data incompatible with tuples format. Each message should be a list of length 2" (fixed test version)
"""gr.Chatbot() component."""
from __future__ import annotations
import inspect
import warnings
from collections.abc import Callable, Sequence
from dataclasses import dataclass, field
from pathlib import Path
from typing import (
@unitycoder
unitycoder / TrackTargets.cs
Created November 22, 2024 07:55 — forked from RyanNielson/TrackTargets.cs
A orthographic camera script for Unity that keeps all targets in frame by adjusting orthographic size and camera position.
using UnityEngine;
public class TrackTargets : MonoBehaviour {
[SerializeField]
Transform[] targets;
[SerializeField]
float boundingBoxPadding = 2f;