Skip to content

Instantly share code, notes, and snippets.

@v01pe
v01pe / BuildHandler.cs
Created August 4, 2021 10:30
Build pre- and post-processing. Workaround for missing build canceled delegate.
using System;
using UnityEditor;
using UnityEditor.Build;
using UnityEngine;
using Object = UnityEngine.Object;
[InitializeOnLoad]
public class BuildHandler : MonoBehaviour
{
/// <summary>
@v01pe
v01pe / unity_templates.sh
Created October 23, 2018 13:34
Replace and add custom script templates for Unity
#!/bin/bash
#locating unity folder
if [ "$#" -gt 0 ]
then
unityFolder=${1%/}
else
unityFolder="/Applications/Unity"
fi
@v01pe
v01pe / DynamicProfilerSamplesSize.cs
Created December 1, 2016 15:39
In Unity add a menu item that toggles between dynamic and the default profiler sample size.
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public static class DebugMenu
{
private static int defaultMaxNumberOfSamplesPerFrame = -1;
private static bool dynamicProfilerSamplesSize = false;
private const string toggleDynamicProfilerSamplesSizeName = "Debug/Dynamic Profiler Sample Size";
@v01pe
v01pe / Example.cs
Last active November 14, 2022 18:03
A relative simple way to get the instance object from a custom property drawer that draws a serialized class inside a component
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
public ExampleClass example;
void Start() {}
void Update() {}
}
@v01pe
v01pe / gitgit.sh
Created April 14, 2015 10:11
Using git on the command line, but tired of typing `git` in front of every command? Use this little script.
#!/bin/bash
lastcmd=""
while [ true ]; do
read -r -e -p "> git " gitcmd
if [ "$gitcmd" != "" ] && [ "$gitcmd" != "$lastcmd" ]; then
lastcmd=$gitcmd
history -s "$gitcmd"
fi
if [ "$gitcmd" == "exit" ]; then