Skip to content

Instantly share code, notes, and snippets.

View Novack's full-sized avatar

Novack

View GitHub Profile
@Novack
Novack / CustomHierarchyView.cs
Created April 12, 2017 14:21 — forked from ilkinulas/CustomHierarchyView.cs
editor script that demonstrates how to customize hierarchy window
using UnityEngine;
using UnityEditor;
using System.Text;
[InitializeOnLoad]
public class CustomHierarchyView {
private static StringBuilder sb = new StringBuilder ();
static CustomHierarchyView() {
@Novack
Novack / Unity-GetAllFilesUnderSelectedFoder.cs
Created April 12, 2017 15:40 — forked from kimsama/Unity-GetAllFilesUnderSelectedFoder.cs
Code snip which shows gather all files under selected folder in Unity's Project View
/// <summary>
/// Retrieves selected folder on Project view.
/// </summary>
/// <returns></returns>
public static string GetSelectedPathOrFallback()
{
string path = "Assets";
foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
{
@Novack
Novack / GetAssetsOfType.cs
Created April 12, 2017 15:43 — forked from kimsama/GetAssetsOfType.cs
Retrieves certain type of assets with the specified file extension at the given path.
/// <summary>
/// Used to get assets of a certain type and file extension from entire project
/// Usage:
/// UnityEngine.Object[] pagePrefabs = GetAssetsOfType("Resources/Prefabs/PAGE", typeof(GameObject), ".prefab");
/// </summary>
/// <param name="type">The type to retrieve. eg typeof(GameObject).</param>
/// <param name="fileExtension">The file extention the type uses eg ".prefab".</param>
/// <returns>An Object array of assets.</returns>
public static UnityEngine.Object[] GetAssetsOfType(string path, System.Type type, string fileExtension)
{
@Novack
Novack / Docker.cs
Created April 13, 2017 17:57 — forked from Thundernerd/Docker.cs
Helper to dock EditorWindows
#if UNITY_EDITOR
using System;
using System.Reflection;
using UnityEditor;
using UnityEngine;
public static class Docker
{
#region Reflection Types

How to Use?

GUIStyle mystyle = new GUIStyle("some string from the list below");


UnityEditor.ConsoleWindow.Constants

  • "CN Box"
  • "Button"
#if UNITY_EDITOR
using System.Reflection;
using UnityEngine;
using UnityEditor;
public class FontSwitcher : EditorWindow
{
[MenuItem("Font/Show Window")]
public static void ShowFontWindow()
{
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
Shader "Hidden/Internal-GUITextureClipText"
{
Properties { _MainTex ("Texture", 2D) = "white" {} }
CGINCLUDE
#pragma vertex vert
#pragma fragment frag
@Novack
Novack / HexGridLayout.cs
Created August 8, 2018 05:45 — forked from PopupAsylumUK/HexGridLayout.cs
A Layout group for arranging children in a hexagon grid, and a Hexagon graphic
using UnityEngine;
using UnityEngine.UI;
public class HexGridLayout : LayoutGroup {
const float SQUARE_ROOT_OF_3 = 1.73205f;
public enum Axis { Horizontal = 0, Vertical = 1 }
public enum Constraint { Flexible = 0, FixedColumnCount = 1, FixedRowCount = 2 }
@Novack
Novack / ActionExtensions.cs
Created August 8, 2018 05:45 — forked from PopupAsylumUK/ActionExtensions.cs
Adds null checking invocations to Actions
using System;
public static class ActionExtensions {
public static void SafeInvoke(this Action action) {
if (action != null) {
action();
}
}
@Novack
Novack / Unity Assembly Definition Debugger.cs
Created September 11, 2018 15:05 — forked from karljj1/Unity Assembly Definition Debugger.cs
Find out what assemblies are being built and how long each takes.
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEditor.Compilation;
[InitializeOnLoad]
public class AsmdefDebug
{
static Dictionary<string, Stopwatch> s_Assemblies = new Dictionary<string, Stopwatch>();