Skip to content

Instantly share code, notes, and snippets.

View noisecrime's full-sized avatar

NoiseCrime noisecrime

View GitHub Profile
@noisecrime
noisecrime / ExtractSceneNames
Created June 21, 2014 21:26
Unity - Access Scenes added to build menu in Inspector.
// NoiseCrime Gist
// 2014.06.21
// Unity Version: 3.5.7+
// This script provides access to a projects scene names in the Inspector.
// It uses MenuItem to assing commands to the component context menu.
// Docs: http://docs.unity3d.com/ScriptReference/MenuItem.html
@noisecrime
noisecrime / App_ValidateMacAddress
Created June 22, 2014 17:06
Unity - Validate Mac Address
// NoiseCrime Gist
// 2014.06.22
// Unity Version: 3.5.7+
// Class to examine all Mac Addresses on Machine, selects the fastest to use as a validation ID.
// Can specify multiple valid Mac Addresses.
// Can Quit Application if valid Mac not found.
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
public class EditorWindowExample : EditorWindow
{
List<Node> nodes = new List<Node> ();
@noisecrime
noisecrime / Editor_DuplicateAnimationAsset
Created July 16, 2014 15:53
Simple editor script to duplicate animation clips found in the selected model/animation asset file. Duplicates unlike original animation clips may be edited.
// NoiseCrime Gist
// 2014.07.16
// Unity Version: 3.5.7+
// Simple editor script to duplicate animation clips found in the selected model/animation asset file.
// Duplicates unlike original animation clips may be edited.
using UnityEngine;
using UnityEditor;
@noisecrime
noisecrime / Generic Shuffle Deck
Last active August 29, 2015 14:19
Generic Shuffle Deck
// ShuffleDeck
// Simple generic (mostly) deck shuffling utility.
using System.Collections.Generic;
using System;
public class ShuffleDeck
{
public static Stack<T> CreateShuffledDeck<T>(IEnumerable<T> values, int numDecks)
// Place this file into a directory called Editor inside of your Assets directory.
// Models imported after you do that will have:
// - Smoothing Angle seto to 180.
// - Normals set to Import.
// - Tangents set to Calculate.
// - Tangents set to Split Tangents.
// Any models that are already imported can have this applied by selecting them in
// the Project panel, right clicking and selecting "Reimport" from the pop-op menu.
@noisecrime
noisecrime / WaitForSecondsReplacement.cs
Created July 27, 2015 08:01
WaitForSeconds replacement - avoid garbage
static public IEnumerator Wait( float duration )
{
while( duration > 0 )
{
duration -= Time.deltaTime;
yield return null; // 'yield return 0;' generates garbage from C# boxing, so always use 'yield return null;' instead
}
}
@noisecrime
noisecrime / UnityTextures.cs
Created October 19, 2015 08:00 — forked from masa795/UnityTextures.cs
Unityが持っているアイコンを表示する。 Unityのバージョンによってはパスが使えなくなるかもしれないので使用時は注意。
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
//Unity 4.1.5
public class UnityTextures : EditorWindow
{
@noisecrime
noisecrime / ScriptExecutionAssignment.cs
Created November 10, 2016 19:47
Editor class that will automatically set the scriptExecutionOrder based on using a ScriptExecutionAttribute.
// ScriptExecutionAssignment
// NoiseCrime
// 11.10.2016
// 05.06.2016
//
//
// Editor class that will automatically set the scriptExecutionOrder based on using a ScriptExecutionAttribute.
// See ScriptExecutionAttribute.cs Gist!
// The class is called automatically everytime Unity recompiles the project - see [InitializeOnLoad]
//
@noisecrime
noisecrime / ScriptExecutionAttribute.cs
Created November 10, 2016 19:48
Support Attribute class that works with the editor script 'ScriptExecutionAssignment' to automatically populate the ScriptExecutionOrder.
// ScriptExecutionAttribute
// NoiseCrime
// 10.11.2016
// 05.06.2016
//
// Support Attribute class that works with the editor script 'ScriptExecutionAssignment' to automatically populate the ScriptExecutionOrder.
// Simply add [ScriptExecutionAttribute( value )] prior to your class declaration, where value indicates the script order you want ( -9999 to +9999 )
// This script must NOT be placed in an Editor Folder.