Skip to content

Instantly share code, notes, and snippets.

@wonkee-kim
wonkee-kim / BoidSimulator.cs
Last active January 12, 2025 23:09
Unity Boid Simulation System using Job System and Burst Compiler
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Mathematics;
using Unity.Jobs;
using Unity.Burst;
using Unity.Collections;
public class BoidSimulator : IDisposable
@wonkee-kim
wonkee-kim / EditorButtonAttribute.cs
Last active January 7, 2025 22:10
Unity EditorButton attribute that shows buttons of methods in the inspector.
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace AnimalCompany
@wonkee-kim
wonkee-kim / HalftoneToon.shader
Last active November 10, 2023 03:35
Halftone toon shader - Unity URP
Shader "Toon/HalftoneToon"
{
Properties
{
_ColorHighlight("Color Highlight", Color) = (1,1,1,1)
_RangeHighlight("Range Highlight", Range(0,1)) = 0.8
_Color("Color", Color) = (0.9, 0.9, 0.9, 1)
_ColorShaded("Color Shaded", Color) = (0.6, 0.6, 0.6, 1)
_RangeShaded("Range Shaded", Range(0,1)) = 0.5
_ColorReflected("Color Reflected", Color) = (0.7, 0.7, 0.7, 1)
@wonkee-kim
wonkee-kim / ObjectDuplicator.cs
Last active April 11, 2023 01:26
Duplicate multiple objects in Unity Editor.
using UnityEngine;
using UnityEditor;
public class ObjectDuplicator : MonoBehaviour
{
public static void DuplicateMultipleObject(GameObject[] targetObjects, int count, Vector3 positionOffset)
{
for (int i = 0; i < count; i++)
{
foreach (var go in targetObjects)
@wonkee-kim
wonkee-kim / GlowingCoreShader.shader
Last active November 10, 2023 03:36
Glowing Core Shader vertex version
Shader "GlowingEfx"
{
Properties
{
_Color("Color", color) = (1,1,1,1)
_GlowCenter("Glow Center", Vector) = (0,0,0)
_GlowSpread("Glow Spread", float) = 0
_GlowStrength("Glow Strength", float) = 1
_Refraction("Refraction", float) = 1
@wonkee-kim
wonkee-kim / RenderObjects.cs
Created August 11, 2020 00:40
Unity URP sample -RenderObjects's RendererFeature
using System.Collections.Generic;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Experimental.Rendering.Universal
{
[MovedFrom("UnityEngine.Experimental.Rendering.LWRP")]public enum RenderQueueType
{
Opaque,
@wonkee-kim
wonkee-kim / RenderObjectsPass.cs
Created August 11, 2020 00:39
Unity URP sample -RenderObjects's RenderPass
using System.Collections.Generic;
using UnityEngine.Rendering.Universal;
using UnityEngine.Rendering;
using UnityEngine.Scripting.APIUpdating;
namespace UnityEngine.Experimental.Rendering.Universal
{
[MovedFrom("UnityEngine.Experimental.Rendering.LWRP")] public class RenderObjectsPass : ScriptableRenderPass
{
RenderQueueType renderQueueType;
@wonkee-kim
wonkee-kim / MyRendererFeature.cs
Created August 11, 2020 00:33
Simplified version of ScriptableRendererFeature
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEngine.Experimental.Rendering.Universal {
public class MyRendererFeature : ScriptableRendererFeature {
[System.Serializable]
@wonkee-kim
wonkee-kim / MyRenderPass.cs
Created August 11, 2020 00:33
Simplified version of ScriptableRenderPass
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;
namespace UnityEngine.Experimental.Rendering.Universal {
public class MyRenderPass :ScriptableRenderPass {
string m_profilerTag;
Material m_blitMaterial;
@wonkee-kim
wonkee-kim / Blit.cs
Created August 11, 2020 00:31
Unity URP Blit with comments
// https://github.com/Unity-Technologies/UniversalRenderingExamples/blob/master/Assets/Scripts/Runtime/RenderPasses/Blit.cshttps://samdriver.xyz/articles/scriptableRender.html
// https://samdriver.xyz/articles/scriptableRender.html
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.Universal;
namespace UnityEngine.Experimental.Rendering.Universal {
// https://github.com/Unity-Technologies/UniversalRenderingExamples/blob/master/Assets/Scripts/Runtime/RenderPasses/Blit.cs