Skip to content

Instantly share code, notes, and snippets.

@karl-
karl- / CleanUpWindow.cs
Created November 15, 2012 03:25
New interface for removing unused Unity assets
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
using System.Collections.Generic;
public class CleanUpWindow : EditorWindow
{
bool groupEnabled = true;
List<string> usedAssets = new List<string>();
@karl-
karl- / glErrorUtil
Last active December 19, 2015 05:28
void PrintGLError(char* previousCall)
{
GLenum err = glGetError();
if(err == GL_NO_ERROR)
return;
// TODO Clip previousCall to MAX_LENGTH
int prevCallLength = strlen(previousCall);
@karl-
karl- / Package Import Loader
Created December 3, 2013 19:35
Bundled with a unitypackage, this script will search for PACKNAME and load an editor window when imported.
class MyPackInstaller : EditorWindow
{
public static void Init()
{
EditorWindow.GetWindow<MyPackInstaller>().Show();
}
void OnGUI()
{
// code to load pack with options here
@karl-
karl- / gist:8050628
Created December 20, 2013 05:11
ProBuilder 2.2.1 release notes

Features

- Update Undo code for Unity 4.3 compatibility (Install Interface will determine the correct package for your Unity version automatically).	
- Add Rotate and Scale tool when editing faces or vertices (accessed by `E` and `R` shortcuts, respectively).
- Add EditLevel toolbar in sceneview for quickly viewing and setting EditLevel. @Genstein suggested improvement.
- New Edge selection mode.
- New `Bridge Edges` action.  Selected 2 edges to create a face bridging them.
- New `Collapse Selected Vertices` action.  Select any number of vertices and merge them to a single point.
- New `Split Selected Vertices` action.  Splits the selected vertices.
- New `Weld Selected Vertices` action.  Checks if any selected vertices share a point, and if so, merge them.
- New `Invert Selection` action. (ProBuilder -&gt; Edit -&gt; Invert Selection).
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System;
using ProBuilder2.Common;
/**
@karl-
karl- / ShiftDuplicateEditor
Last active April 17, 2023 17:20
Unity Shift-Duplicate
using UnityEngine;
using UnityEditor;
using ProBuilder.Core;
using ProBuilder.EditorCore;
[InitializeOnLoad]
static class ShiftDuplicate
{
static bool m_IsDragging = false;
using UnityEngine;
/**
* An empty script used to provide some reference for null components so that we can delete them.
*/
public class pb_DummyScript : MonoBehaviour {}
using UnityEditor;
using UnityEngine;
using System.Linq;
using ProBuilder2.Common;
using ProBuilder2.EditorCommon;
namespace ProBuilder2.Actions
{
/**
* Menu interface for manually re-generating all ProBuilder color arrays in scene.

ProBuilder 2.4.4f1 (r3385)

Features

  • Where possible* indices are now collapsed to share a single vertex.
  • Add context menu to swap between dockable window modes in vertex painter.
  • Unity 5.1 beta compatibility.
  • New Icosphere shape.
  • New API example shows a deformed icosphere with FFT spectrum.
  • Grow Selection is now roughly one gajillion times faster.
using UnityEngine;
using UnityEditor;
using UnityEngine.UI;
using System.Collections;
using System.Linq;
[InitializeOnLoad]
public class HideShowCanvas : Editor
{
static HideShowCanvas()