Skip to content

Instantly share code, notes, and snippets.

View kurtdekker's full-sized avatar

Kurt Dekker kurtdekker

View GitHub Profile
using UnityEngine;
public class Ballistic : MonoBehaviour
{
public Vector3 velocity;
void Update ()
{
velocity += Physics.gravity * Time.deltaTime;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MyScript : MonoBehaviour
{
// Always call this to create MyScript objects so we know they are complete.
// Never use AddComponent<MyScript>() outside of this class.
public static MyScript Create(
string resourcesPath,
@kurtdekker
kurtdekker / TTL.cs
Created June 3, 2021 21:23
TTL - TimeToLive
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TTL : MonoBehaviour
{
public float AgeLimit;
float age;
public System.Action<GameObject> Callback;
@kurtdekker
kurtdekker / DuplicationHelpers.cs
Last active May 24, 2023 03:14
Waypoint gizmo and waypoint manager
using UnityEngine;
using UnityEditor;
// @kurtdekker
// Make sure this is in an Editor folder!
public static class DuplicationHelpers
{
// duplicates the current object and puts it back right after the original.
[MenuItem( "Assets/Dupe Here FFS")]
// Originally from:
// http://forum.unity3d.com/threads/script-simple-script-that-automatically-adjust-anchor-to-gui-object-size-rect-transform.269690/
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using System.Collections;
public class AnchorExtensions : MonoBehaviour {
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// @kurtdekker
//
// This is to take any continuous quantity and change it from one value
// to another over time. This code is for floats. It can be adapted to work for:
//
// Vector2, Vector3, Vector3
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// by @kurtdekker - handy example of simple persistent settings.
//
// To use, just use the variables like any other:
//
// SETTINGS.VolumeLevel = 1.0f;
//
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// by @kurtdekker - to make a Unity singleton that has some
// prefab-stored, data associated with it, eg a music manager
//
// To use: access with SingletonViaPrefab.Instance
//
// To set up:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// by @kurtdekker - to make a simple Unity singleton that has no
// predefined data associated with it, eg, a high score manager.
//
// To use: access with SingletonSimple.Instance
//
// To set up:
// From: https://answers.unity.com/questions/801928/46-ui-making-a-button-transparent.html?childToView=851816
//
// @kurtdekker
//
// Touchable invisible non-drawing Graphic (usable with Buttons too):
//
// To make an invisible Button:
//
// 1. make a Button in the normal way
// 2. delete the "Text" GameObject which comes below a Button as standard