Skip to content

Instantly share code, notes, and snippets.

View mrwellmann's full-sized avatar

Markus Wellmann mrwellmann

View GitHub Profile
@mrwellmann
mrwellmann / UnityHololens.gitignore
Created March 9, 2017 10:52
Template for Hololens Unity .gitignore file
#Sources:
#https://github.com/github/gitignore/blob/master/Unity.gitignore
#https://github.com/Microsoft/HoloToolkit-Unity/blob/master/.gitignore
#https://github.com/Microsoft/GalaxyExplorer/blob/master/.gitignore
#https://gist.github.com/Ikalou/197c414d62f45a1193fd
# =============== #
# Unity generated #
# =============== #
/[Ll]ibrary/
@mrwellmann
mrwellmann / RandomDistinctIntegers.cs
Created October 26, 2016 16:01
Random distinct integers for Unity
using UnityEngine;
public static class RandomDistinctIntegers
{
/// <summary>
/// Generates distinct integers.
/// The Integers inside the array are not randomized. If n = range;
/// This Algorithm works good for a lager amount of numbers and uses less memory than Fischer.
/// Source: https://visualstudiomagazine.com/articles/2013/07/01/generating-distinct-random-array-indices.aspx
/// </summary>
/// <param name="size"> Number of distinct values to generate.</param>
@mrwellmann
mrwellmann / DependencyResolver.cs
Created July 27, 2021 11:42
DependencyResolver for Unity - This is essentially doing dependency injection.
//source https://github.com/microsoft/MixedRealityToolkit-Unity/issues/1654#issuecomment-359114223
using System;
using System.Collections.Generic;
using System.Reflection;
/// <summary>
/// The dependency resolver allows classes to register themselves as the instance to be used for a given interface.
/// Other classes can then query the dependency resolver to get the instance to use.
/// This is essentially doing dependency injection.
/// <summary>
/// This tool helps to identify and remove empty folders from your Unity 3D project.
///
/// /// Why do I need this:
/// Empty folders are not committed by git but the connected meta files are.
/// So there will be a creation - deletion cycle between between person with and without such a folder.
///
/// /// Usage:
/// The tool adds a new menu Tools->Empty Folder Tool.
/// 1. If you "Toggle Auto Delete", every time you remove or move something in your project
@mrwellmann
mrwellmann / ScriptNameEditor.cs
Last active November 30, 2023 12:23
Draw Script Fields to the Script and EditorScript of a Unity UGUI Editor Extension
private void DrawScriptFields()
{
EditorGUI.BeginDisabledGroup(true);
MonoScript monoScript = (target as MonoBehaviour) != null
? MonoScript.FromMonoBehaviour((MonoBehaviour)target)
: MonoScript.FromScriptableObject((ScriptableObject)target);
EditorGUILayout.ObjectField("Script", monoScript, GetType(), false);
MonoScript monoScript2 = MonoScript.FromScriptableObject((ScriptableObject)this);

Keybase proof

I hereby claim:

  • I am mrwellmann on github.
  • I am mrwellmann (https://keybase.io/mrwellmann) on keybase.
  • I have a public key ASD9wy4mmkqlMKNTD_QhGBJ1iQRtAggbplUeGsn23QHaEQo

To claim this, I am signing this object: