Skip to content

Instantly share code, notes, and snippets.

View StagPoint's full-sized avatar

StagPoint Software StagPoint

  • StagPoint Software
  • Seattle, WA
View GitHub Profile
@simon-brooke
simon-brooke / doxygen-snippet.msbuild
Created August 24, 2017 16:38
How to build documentation with Doxygen from an msbuild script
<PropertyGroup>
<DocDirectory>..\Documentation\</DocDirectory>
<Doxyfile>..\Doxyfile</Doxyfile>
</PropertyGroup>
<Target Name="Doxygen">
<MakeDir Directories="$(DocDirectory)" />
<Exec Command="doxygen.exe $(Doxyfile)" />
</Target>
<Target Name="DoxyClean">
<RemoveDir Directories="$(DocDirectory)\html" />
@ArieLeo
ArieLeo / DebugDraw.cs
Created September 26, 2017 13:53 — forked from speps/DebugDraw.cs
DebugDraw - Unity3D based debug drawing for programmers
// Remi Gillig - http://speps.fr - 2012 - Public domain
using System;
using System.Collections.Generic;
using UnityEngine;
public class DebugDraw
{
static Material material = new Material(
@"Shader ""Custom/DebugDraw"" {
@bugshake
bugshake / ObservableProperty.cs
Created October 2, 2017 18:50
C# Observable Property
// get an event when a property changes
public class ObservableProperty<T>
{
T value;
public delegate void ChangeEvent(T data);
public event ChangeEvent changed;
public ObservableProperty(T initialValue)
{
@redxdev
redxdev / DungeonGenerator.cs
Last active September 11, 2022 06:23
2d Dungeon Layout Generator
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
// NOTE: Some of the classes here (namely the primitives like Vector2d and Rect2d) are not provided,
// but most should be fairly easy to implement yourself or replace with similar
// classes from other libraries.
// The exception is the Delaunay triangulation - that takes quite a bit more effort to implement. That said,
#if UNITY_EDITOR
using System.Reflection;
using UnityEngine;
using UnityEditor;
public class FontSwitcher : EditorWindow
{
[MenuItem("Font/Show Window")]
public static void ShowFontWindow()
{
@Hertzole
Hertzole / SceneObject.cs
Last active May 4, 2024 13:04
Unity scene object to easily assign scenes in the inspector.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class SceneObject
{
[SerializeField]
private string m_SceneName;
@LotteMakesStuff
LotteMakesStuff / MinMaxAttribute.cs
Last active March 18, 2025 10:31
MinMax property drawer for Unity - Add a [MinMax] attribute to a property to draw a useful min/max setting slider.
// NOTE DONT put in an editor folder
using UnityEngine;
public class MinMaxAttribute : PropertyAttribute
{
public float MinLimit = 0;
public float MaxLimit = 1;
public bool ShowEditRange;
public bool ShowDebugValues;
@patricknelson
patricknelson / Quaternion.shader
Last active April 13, 2025 11:21 — forked from nkint/pointTowards.vertex
Shader functions to facilitate rotation of vertex around point with a quaternion (Unity / HLSL / Cg)
// Full shader example demonstrating how to use a quaterionion to rotate a vertex around a specific point. Note that this is just a plain
// vanilla unlit shader which includes the necessary functions (see section below) and example code in the vertex shader.
//
// Forked from https://gist.github.com/nkint/7449c893fb7d6b5fa83118b8474d7dcb
// Converted from GLSL to Cg. For help with that, see https://alastaira.wordpress.com/2015/08/07/unity-shadertoys-a-k-a-converting-glsl-shaders-to-cghlsl/
//
// quaternion code from https://github.com/stackgl/gl-quat
// rotation from https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/
Shader "Unlit/Quaternion"
@LotteMakesStuff
LotteMakesStuff / EditorExtensionMethods.cs
Last active January 12, 2025 14:33
A reimplementation of the logic in the Unity Editor that draws an inspector for a component. We can use this to learn how unity actually draws the inspector. for more info see https://www.patreon.com/posts/16724128
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.Reflection;
public static class EditorExtensionMethods
{
// Public reimplmentation of extention methods and helpers that are marked internal in UnityEditor.dll
@distantcam
distantcam / JobHelper.cs
Last active August 17, 2023 15:54
Unity Job system with async
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks;
using Unity.Jobs;
public static class JobHelper
{