Skip to content

Instantly share code, notes, and snippets.

View GhatSmith's full-sized avatar

Ghat Smith GhatSmith

View GitHub Profile
@GhatSmith
GhatSmith / OpenAdditionalLockedInpsector.cs
Created November 27, 2018 17:45
Little script to open a locked inspector window as popup in Unity
using UnityEditor;
using UnityEngine;
using System.Reflection;
namespace Framework.Core.EditorExtension
{
public class OpenAdditionalLockedInpsector : MonoBehaviour
{
private static EditorWindow lockedInspectorWindow = null;
@GhatSmith
GhatSmith / OpenAdditionalAnimatorWindow.cs
Created November 27, 2018 17:28
Little script to open an additional Animator window in Unity
using UnityEditor;
using UnityEngine;
namespace Framework.Core.EditorExtension
{
public class OpenAdditionalAnimatorWindow : MonoBehaviour
{
static EditorWindow window = null;
@GhatSmith
GhatSmith / ifEditor.snippet
Last active October 11, 2018 23:20
Visual Studio snippet for Unity Editor dependent compilation
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>#ifEditor</Title>
<Shortcut>#ifEditor</Shortcut>
<Description>Code snippet for #if UNITY_EDITOR</Description>
<Author>Ghat Smith</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@GhatSmith
GhatSmith / UpdateDispatcher
Created September 27, 2018 21:52
UpdateDispatcher to have Update even when GameObjecct or script is disabled, or have update callback for non MonoBehaviour scripts
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public interface IUpdateListener
{
@GhatSmith
GhatSmith / MainThreadQueue.cs
Created September 26, 2018 23:10
Script allowing to execute code on the main thread. Can be useful if you need to delay code execution or call Unity API without controlling code flow. Like when implementing Unity ISerializationCallbackReceiver interface.
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Assertions;
using System.Threading;
#if UNITY_EDITOR
using UnityEditor;
#endif
@GhatSmith
GhatSmith / GenericFilter
Created September 24, 2018 22:22
GenericFilter
using System.Collections.Generic;
using UnityEngine;
/// <summary> "Generic class. Include logic if you want to define collection of elements with exceptions" </summary>
[System.Serializable]
public class GenericFilter<T>
{
private enum Type { NothingExcept, AllExcept }
@GhatSmith
GhatSmith / AnimatorControllerExtension
Created September 22, 2018 17:07
AnimatorControllerExtension
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using UnityEngine;
using UnityEditor.Animations;
public static class AnimatorControllerExtension
{
private static MethodInfo getEffectiveAnimatorControllerMethodInfo = null;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public static class OrderedSelection
{
// For Objects ordered selection
private static HashSet<Object> objectsSelectionSet = new HashSet<Object>();
using UnityEngine;
using UnityEditor;
using System.Linq;
using UnityEngine.SceneManagement;
using System.Globalization;
namespace OddTales.Framework.Core.EditorExtension
{
// InitializeOnLoad : force constructor call
// Based on : http://baba-s.hatenablog.com/entry/2014/07/30/152826
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;