• Stars
    star
    216
  • Rank 183,179 (Top 4 %)
  • Language
    C#
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A set of single script utils used throughout my projects

A set of single-script Unity utilities I created or collected over the many years of gamedev. You can freely drop any of the individual files in your project and they should work out of the box. The repo can also be used as a Unity package. If you wish to use it like that, just add the git link to your package manager. Many of these scripts could be previously found on my gist.

Most scripts contain description on how to use them in the header, unless the usage is self evident.

Includes:

  • GizmosX.cs - Extensions for drawing additional gizmos in OnDrawGizmos() function, like circles, cubes (with rotation!), labels, arcs, heightfields etc.. Editor only.
  • SingletonScriptableObject.cs - A self referencing ScriptableObject, useful for global game settings and such.
  • Closest.cs - Extension for finding a closest instance for an array of components. E.g. Clock closestClock = listOfClocks.GetClosest(player.transform.position);
  • RTUtils.cs - RenderTexture utilities for direct drawing meshes, texts and sprites and converting to Texture2D. See full docs here.
  • ProceduralReverb.cs - Calculates reverb parameters by raycasting into the world around the player (naive and not really physically accurate). First used in "Bruturb".
  • ObjectPreviewer.cs - Directly draws a GameObject for preview without any object cloning. Used for example when you want to preview the "build" location in RTS games.
  • BoundsUtils.cs - Additional utils for bounds like finding bounds of an entire GameObject in world or local space, collider bounds, transforming bounds, etc.
  • LabelDrawer.cs - Draws labels anywhere in 3D space as long as it's called.
  • BezierUtility.cs - Contains both pure functions and a struct (for ease of use), for drawing, finding tangents and closest points for cubic bezier curves. Originally derived from BezierUtility found in Unity's URP package.
  • ArrayRandomExtension.cs - Extension for getting a random element from a list or array with array.GetRandom()
  • NamedArrayAttribute.cs - Replaces array element labels with enum names in the inspector.
  • TwinSorter.cs - Sorts a "target" list by values in the "sorter" list. Useful when having a cache of precomputed values by which you want to sort another list and avoid delegates or Linq.
  • RingBuffer.cs - A simple fixed-sized contiguous double-sided indexable ring buffer (circular queue).
  • AssetDatabaseUtils.cs - Provides a few useful functions to help with AssetDatabase usage, like creating an asset with the full folder hierarchy, etc.
  • ADSREnvelope.cs - Attack-Decay-Sustain-Release envelope helper struct. Can also keep time state, just pass a signal and deltaTime to Update() and it will give you a float. Also comes with a custom property drawer.
  • Interpolator.cs - A smooth transition between two states wrapper struct. Also includes an InertialInterpolator that transits in a physical with accelerating and braking and smooth interruption. E.g. for closing/opening massive doors.
  • CableMaker.cs - Builds LineRenderer-based hanging cables/wires using catenary formula. Also has a static function for filling up a list of points so you can use it with any other rendering system.
  • PID.cs - Struct-based PID controllers for Float, Vector2 and Vector3.
  • Pivot.cs - Struct based position & rotation wrapper with scene editing. Used to avoid overhead of empty child GameObjects when relative points are required.

Other utils you might like not in this repo:

  • FlyCam - Simple WASD flyable camera with zooming and changing speed on scroll.
  • NAudio - Single line audio playing utils.
  • NDraw - Runtime [debug] line drawing. similar to Unity's Gizmos, but runtime.
  • ProtoGUI - Runtime window drawer with a few additional tricks that looks a bit better than Unity's standard GUI.

License:

All scripts use MIT license. Primarily to avoid liability. License info is embedded in each script as they are meant to be used separately.

More Repositories

1

ProtoGUI

Simple, quick and good looking GUI windows for Unity, intended for prototyping and debugging
C#
123
star
2

UnityShaderCheatsheet

Collection of Unity shader copypastas and gotchas
ShaderLab
123
star
3

dx-highlighter

A Deus Ex/System Shock inspired pulsing bounds item highlighter for Unity
C#
90
star
4

UnityDOTSGotchas

Various DOTS Gotchas collected by me
69
star
5

normans-sky

Normans Sky made for lowrezjam '16
C#
66
star
6

csDelaunayUnity

GC free (non alloc) voronoi diagram for Unity
C#
56
star
7

NDraw

Runtime line drawing utility for Unity
C#
36
star
8

blender_unity_rotation_fix

Rotation fix for exporting from Blender to Unity
Python
33
star
9

StarMap

Rendering of stars in the night sky using the HYG database
C#
30
star
10

gridventory

Functions for making a simple grid inventory in Unity
C#
30
star
11

pikoralli

A small rally game made in pico8
Lua
15
star
12

b3d-attribute-converter

Converts geometry node attributes to built-in attributes
Python
13
star
13

Unity-Raymarching

GLSL
13
star
14

shakedown-docs

Documentation for Shakedown Rally
12
star
15

atmospheric-scattering

Atmospheric Scattering Unity package
C#
11
star
16

MeshX

Mesh extensions for Unity
C#
10
star
17

SimpleVanAllenBelts

SDF based Van Allen belt sampler, implemented in C# (Unity)
C#
10
star
18

SpinningMeshMotionBlur

Motion blur for fast spinning objects by rendering multiple meshes - example
C#
9
star
19

NativeMeshTests

Testing new Mesh support for NativeArray in Unity 2019.3
C#
9
star
20

serialization-experiments

Unity serialization experiments
C#
9
star
21

JobifiedTextureModifyTests

C#
8
star
22

PicoSpaceProgram

2D space program for Demake Jam 2018
Lua
7
star
23

AStar

A Unity package for basic AStar pathfinding
C#
7
star
24

IndentedDialogueParser

C#
7
star
25

LiteRally

A GeneRally clone
C#
6
star
26

NEngine

Learning how to make a small opengl game engine
C++
6
star
27

ThreadableCurve

Unity AnimationCurve that is thread safe
C#
6
star
28

Unity-VS-Code-Snippets

Vim Snippet
5
star
29

FPSCounter

Simple FPS Counter for Unity
C#
4
star
30

NAudio

Shortcuts/extensions for a single line audio clip playing and audio source creation
C#
4
star
31

ecs-ribbon

C#
3
star
32

DoublePhysics

Double precision rigidbody physics for Unity
C#
3
star
33

blender_ac_exporter

One-click Assetto Corsa fbx export utility for Blender
Python
3
star
34

FlyCam

A simple package for flying the camera around
C#
3
star
35

CableMaker

C#
2
star
36

nothke.github.io

JavaScript
2
star
37

mat2id_baker

Material to id map baker for blender that DOESN'T use Cycles
Python
2
star
38

ProcPort

Airport simulation for a PROCJAM project
C#
2
star
39

rts-proto

C#
2
star
40

GGJ18

The TV game
C#
2
star
41

PlaneParkingPackingProblem

3D tetris with planes and physics
C#
2
star
42

TODO-syntax-highlighter

A simple syntax highlighter for Sublime for TODO lists
2
star
43

CreaseOutline

Object highlight for Unity
C#
1
star
44

perfect-wave

A GGJ 17 game
C#
1
star
45

ECSJam

C#
1
star
46

quality-control

GMTK '24 game
C#
1
star
47

TCIBTTCT-code-ref

Code reference for TCIBTTCT towers
1
star
48

depplier

Script for easier C++ dependancies assignment
Python
1
star
49

cpp-project-template

Personal C++ premake project template
Python
1
star
50

moonsharp-unity-upm

A copy of Moonsharp for Unity that works with Unity package manager
C#
1
star
51

bezier-curves

Improved Bezier curves for Unity
C#
1
star
52

paths

General purpose simple networked paths for Unity
C#
1
star
53

mesh-as-asset

Test project for saving procedural meshes outside of scene files
C#
1
star
54

ProcPuddler

Filling a heightmap with standing water
C#
1
star
55

NAudio-Project

Shortcuts/extensions for a single line audio clip playing and audio source creation
C#
1
star
56

hanoi-track-ac

Vietnam GP Hanoi track for Assetto Corsa, source files
1
star
57

vehdyn-interfaces

Package for interfacing between various vehicle dynamics implementations
C#
1
star