Skip to content

Instantly share code, notes, and snippets.

View michidk's full-sized avatar
🐳
🐳🐳

Michael Lohr michidk

🐳
🐳🐳
View GitHub Profile
using UnityEngine;
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
public class LSystemGenerator : MonoBehaviour
{
[Serializable]
using UnityEngine;
public class Singleton<T> : MonoBehaviour where T : MonoBehaviour
{
protected static T instance;
/**
Returns the instance of this singleton.
*/
@michidk
michidk / .gitignore
Created September 15, 2015 23:14
.gitignore for IntelliJ & Gradle
# .gitignore for IntelliJ & Gradle made by @miichidk
# IntelliJ
*.iml
.idea/
*.ipr
*.iws
/out/
.idea_modules/
atlassian-ide-plugin.xml
@michidk
michidk / Example.cs
Last active April 8, 2018 02:31
C# + Unity Convention
using System.Collections;
using System.Collections.Generic;
namespace Default // or <Company>.(<Product>|<Technology>)[.<Feature>][.<Subnamespace>]
{
public class Example
{
// first consts
public const int TheAnswer = 42;
@michidk
michidk / gist:6f076258f38f29be77cb
Created January 28, 2016 22:44
C# is awesome
These 3 pieces of codes, are all returning wether a list/dictionary has elements or not.
Normal:
int count = 0;
foreach (var ep in IPEndPoints)
{
if (ep.Value == null)
{
count++;
}
@michidk
michidk / TagManager.cs
Created March 21, 2016 13:41
Unity3D: a class which checks if a tag is defined. also could create new ones or remove them.
public static class TagManager
{
private const string TAG_MANAGER_PATH = "ProjectSettings/TagManager.asset";
public static bool ContainsTag(string tag)
{
SerializedProperty prop;
if (GetAssetDatabase(out prop))
{
for (int i = 0; i < prop.arraySize; i++)
@michidk
michidk / TreeRandomizerWindow.cs
Created April 6, 2016 20:21
Unity3D Tree Randomizer
using System;
using System.CodeDom;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using Random = UnityEngine.Random;
@michidk
michidk / multiclone.bat
Created October 4, 2016 14:45
Clone multiple repos (listed in text file) at once
@echo off
for /F "tokens=*" %%i in (repos.txt) do call :DOSTUFF %%i
pause > nul
:DOSTUFF
echo "Cloning %~1"
git clone https://michidk@bitbucket.org/brokenvector/%~1.git
@michidk
michidk / OutlineShader.shader
Last active May 28, 2024 17:13
An outline shader made for Unity with the help of @OverlandGame. It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// An outline shader made for Unity with the help of @OverlandGame by @miichidk
// It adjusts the size of the outline to automatically accomodate screen width and camera distance.
// See how it looks here: https://twitter.com/OverlandGame/status/791035637583388672
// How to use: Create a material which uses this shader, and apply this material to any meshrenderer as second material.
Shader "OutlineShader"
{
Properties
{
_Width ("Width", Float ) = 1
_Color ("Color", Color) = (1,1,1,1)
@michidk
michidk / CustomUnlitShaderTemplate.shader
Created January 20, 2018 13:57
Amplify Shader Editor: Better Default Unlit Shader Template
Shader /*ase_name*/ "CustomUnlit" /*end*/
{
Properties
{
/*ase_props*/
}
SubShader
{
Tags{ "RenderType" = "Opaque" "LightMode" = "ForwardBase" /*ase_tags*/ }