Skip to content

Instantly share code, notes, and snippets.

@aholkner
aholkner / SerializedPropertyExtensions.cs
Last active June 12, 2025 14:28
Unity editor extension providing value get/set methods for SerializedProperty. This simplifies writing PropertyDrawers against non-trivial objects.
/* MIT License
Copyright (c) 2022 Alex Holkner
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@lazlo-bonin
lazlo-bonin / UndoUtility.cs
Last active June 17, 2024 12:51
Fixing Unity's broken Undo.RecordObject
using UnityEditor;
using UnityEngine;
using UnityObject = UnityEngine.Object;
namespace Ludiq
{
public static class UndoUtility
{
private static void RecordObject(UnityObject uo, string name)
{
using UnityEditor;
using UnityEngine;
using UnityEditor.SceneManagement;
public class Sample
{
static void CreateStage1()
{
EditorSceneManager.NewScene (NewSceneSetup.EmptyScene, NewSceneMode.Single);
var obj = new GameObject ("sample");
@rap2hpoutre
rap2hpoutre / example
Last active August 30, 2017 00:15
Procedural drum loops
kicks = "D:/Sound/procedural/kicks"
snares = "D:/Sound/procedural/snares"
hh = "D:/Sound/procedural/hats/"
ohh = "D:/Sound/procedural/ohats/"
rides = "D:/Sound/procedural/rides/"
crashes = "D:/Sound/procedural/crashes/"
use_random_seed 401492
define :crash do
@jessefreeman
jessefreeman / TextureData.cs
Created April 6, 2016 15:15
A class that emulates the API of Unity's Texture2D but uses int as references to color index instead of the color class.
using System;
namespace PixelVision.Engine.Chips.Graphics.Sprites
{
public interface ITextureData
{
int width { get; }
int height { get; }
int GetPixel(int x, int y);
void SetPixel(int x, int y, int value);
@omgwtfgames
omgwtfgames / A set of Unity3D extension methods
Last active March 2, 2024 17:44
Some useful extension method for Unity3D
A collection of useful C# extension methods for the Unity engine.
@poemdexter
poemdexter / proof.cs
Created June 19, 2013 01:42
music in unity proof of concept
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(AudioSource))]
public class SoundPOC : MonoBehaviour
{
FContainer container;
CBox greenbox;
bool started = false;
@adamawolf
adamawolf / Apple_mobile_device_types.txt
Last active November 16, 2025 07:22
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S