Skip to content

Instantly share code, notes, and snippets.

View kurtdekker's full-sized avatar

Kurt Dekker kurtdekker

View GitHub Profile
@kurtdekker
kurtdekker / LaneMover.cs
Created June 26, 2023 13:50
Lane-based motion in the X- and Z- coordinate space
using UnityEngine;
// @kurtdekker - lane-based mover
//
// To use:
// Drop this on your player object
// Move your camera to see it go into the distance (see note about 2D below)
// press PLAY
// use A and D to change lanes
@kurtdekker
kurtdekker / SimpleMouseSpeed.cs
Created June 9, 2023 18:37
Simple reporter of mouse movement speed in pixels.
using UnityEngine;
// @kurdekker - reports mouse speed in screen pixels per second.
//
// To use:
// - drop on an empty GameObject
// - make sure the console will be visible
// - press PLAY
// - wiggle your mouse
// - watch your console
@kurtdekker
kurtdekker / ChaseParent.cs
Created April 4, 2023 00:58
chase a parent transform, rotation and position only (not scale)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker - used to LateUpdate()-chase another
// Transform, position and rotation only.
//
// To use, call the Attach() factory, tell it:
// - who you are that want to chase
// - the target you want to chase
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker - making a structural grid in Unity3D
// to use: drop this in a blank scene and watch!
//
// NOTE: this makes a web with a central link.
// you could do other connectivity strategies obviously.
@kurtdekker
kurtdekker / MusicManager.cs
Last active March 25, 2025 16:53
Ultra simple Music Manager
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker - example of an ultra-simple music manager.
//
// How to use:
// MusicManager.Instance.PlayMusic( Audioclip clip);
//
// Call the above with null to stop music.
@kurtdekker
kurtdekker / PerformChangeOnAllScenes.cs
Created December 29, 2022 16:04
Perform a change on ALL of your scenes - BE CAREFUL!
using UnityEngine;
using UnityEditor.Callbacks;
using UnityEditor;
using UnityEditor.SceneManagement;
// @kurtdekker - 8:01 AM 12/29/2022
public class PerformChangeOnAllScenes
{
[MenuItem( itemName: "Assets/Perform Change On ALL Scenes")]
@kurtdekker
kurtdekker / DestroyOnAwake.cs
Created December 27, 2022 05:35
a way to put design elements in your Unity scene so they disappear when you play.
using UnityEngine;
// @kurtdekker - Attach this script to GameObjects you
// want to have in your scene for alignment and design,
// but you want to be destroyed during real gameplay.
public class DestroyOnAwake : MonoBehaviour
{
void Awake()
{
@kurtdekker
kurtdekker / MakeGeometryDoubleSided.cs
Created December 21, 2022 17:24
Simple runtime geometry double-sider (duplicate geometry, flips triangles)
using UnityEngine;
// @kurtdekker - simple runtime geometry double-siding mechanism.
//
// Place or add this Component to things with at
// least a MeshFilter on them.
//
// Presently only for single-submesh geometry.
//
// Copies vertex position and uv, then recalculates
@kurtdekker
kurtdekker / OverlayBlocker.cs
Last active January 12, 2026 05:28
Overlay input-blocking facility for Unity3D (input / click blocker / inhibitor)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// Purpose:
// - to inhibit processing of input whenever a popup is enabled
//
// To use:
@kurtdekker
kurtdekker / MachinegunSound.cs
Created October 12, 2022 13:55
Machinegun Sound (automatic gunfire) synthesis in Unity3D
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker - synthesizes a cheesy machinegun sound
//
// DO NOT PUT THIS IN ANY SCENE!!!!
//
// Instead, simply use it by calling:
//