Skip to content

Instantly share code, notes, and snippets.

Dominik Haas DomDomHaas

Block or report user

Report or block DomDomHaas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DomDomHaas
DomDomHaas / ScenePaletteSwitcherInspector.cs
Created Feb 16, 2017
The Editor script for the ScenePaletteSwitcher.cs (https://gist.github.com/DomDomHaas/518d60d388bc593b2ffa5975abb9172b Is only working with the ColorPalettes u3d.as/bFr extension)
View ScenePaletteSwitcherInspector.cs
using System.Linq;
using System.Reflection;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
#pragma warning disable 3009
namespace MrWhaleGames.ColorPalette
{
@DomDomHaas
DomDomHaas / ScenePaletteSwitcher.cs
Created Feb 16, 2017
Unity C# Script to change all the ColorPalettes in a scene. (Is only working with the ColorPalettes u3d.as/bFr extension)
View ScenePaletteSwitcher.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MrWhaleGames.ColorPalette
{
[ExecuteInEditMode]
public class ScenePaletteSwitcher : MonoBehaviour
{
@DomDomHaas
DomDomHaas / Arduino Tinylab Debounce Buttons
Created Nov 1, 2016
arduino Tinylab buttons handling in a debounce style
View Arduino Tinylab Debounce Buttons
// This example code is based on http://www.arduino.cc/en/Tutorial/Debounce
boolean debug = true;
long debounceDelay = 50;
class LEDButton{
public:
int buttonPin = 0;
int buttonState = 0;
int lastButtonState = LOW;
@DomDomHaas
DomDomHaas / ScreenshotSequencer
Last active Feb 25, 2016
ScreenshotSequencer for Unity. Choose a Key to hit while taking a Sequence of Screenshots.
View ScreenshotSequencer
#if UNITY_EDITOR
// only got it to work in the Editor
using UnityEngine;
using System;
using System.Collections;
using System.IO;
public class ScreenshotSequencer : MonoBehaviour
@DomDomHaas
DomDomHaas / PostBuildHook
Last active Aug 29, 2015
PostBuildHook for Unity
View PostBuildHook
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor.Callbacks;
using UnityEditor;
using System.IO;
public static class PostBuildHook
{
private static int filecount;
@DomDomHaas
DomDomHaas / SaveHook
Created Dec 7, 2014
Unity SaveHook to save all persistencyIds
View SaveHook
using UnityEngine;
using UnityEditor;
using JSONPersistency;
using UnityEditor.Callbacks;
public class SaveSceneHook : AssetModificationProcessor
{
static string[] OnWillSaveAssets (string[] paths)
{
@DomDomHaas
DomDomHaas / DragNDropInspector
Created Nov 14, 2014
Unity Editor Drag'n'Drop
View DragNDropInspector
using UnityEngine;
using UnityEditor;
using System.Collections;
using JSONPersistency;
[CustomEditor(typeof(DragNDrop))]
public class DragNDropInspector : Editor
{
Color picked = Color.green;
@DomDomHaas
DomDomHaas / DrawCircle_Unity
Created Nov 11, 2014
Unity Inspector script to draw a circle in the SceneView
View DrawCircle_Unity
using UnityEngine;
using UnityEditor;
// replace "SpawnZone" with the class of your Script on a GameObject
[CustomEditor(typeof(SpawnZone))]
public class SpawnZoneInspector : Editor
{
// replace "SpawnZone" with the class of your Script on a GameObject
private SpawnZone myZone;
@DomDomHaas
DomDomHaas / reorderableList
Created Oct 8, 2014
ReorderableList for Unity
View reorderableList
private ReorderableList list;
list = new ReorderableList(property.serializedObject, property.FindPropertyRelative("tagList"), true, true, true, true);
list.drawHeaderCallback += rect => GUI.Label(rect, label);
list.drawElementCallback += (rect, index, active, focused) =>
{
rect.height = 16;
rect.y += 2;
EditorGUI.PropertyField(rect,
list.serializedProperty.GetArrayElementAtIndex(index),
@DomDomHaas
DomDomHaas / stick-deadzone
Last active Aug 29, 2015
Use a deadzone for very used, old controllers which aren't percise anymore
View stick-deadzone
// http://www.third-helix.com/2013/04/12/doing-thumbstick-dead-zones-right.html
float deadzone = 0.25f;
Vector2 stickInput = new Vector2(Input.GetAxis(“Horizontal”), Input.GetAxis(“Vertical”));
if(stickInput.magnitude < deadzone)
stickInput = Vector2.zero;
else
stickInput = stickInput.normalized * ((stickInput.magnitude - deadzone) / (1 - deadzone));
You can’t perform that action at this time.