Skip to content

Instantly share code, notes, and snippets.

View AGeorgy's full-sized avatar

George Ananchenko AGeorgy

View GitHub Profile
@LotteMakesStuff
LotteMakesStuff / EditorCoroutineRunner.cs
Last active August 28, 2024 19:09
Run stuff in the editor with all the convenience of co-routines! Add a status UI super easily to see readouts what your long running code is actually doing! nice~ There is a short API demo at the top of the class. This is a prefect companion for my inspector buttons https://gist.github.com/LotteMakesStuff/dd785ff49b2a5048bb60333a6a125187
using UnityEngine;
using UnityEditor;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
public class EditorCoroutineRunner
{
[MenuItem("Window/Lotte's Coroutine Runner: Demo")]
@bddckr
bddckr / CleanUpGameObjectSystem.cs
Last active July 14, 2021 07:55
A small example on how to use the same kind of system for multiple contexts in Entitas 0.37.0(+) while making usage of a shared component.
using System.Collections.Generic;
using Components.GameObjects;
using Components.Miscellaneous;
using Entitas;
using Entitas.Unity.VisualDebugging;
using EntitasHelpers;
using JetBrains.Annotations;
public sealed class CleanUpGameObjectSystem<TEntity> : ReactiveSystem<TEntity> where TEntity : class, IEntity, new()
{
using System;
using UnityEngine;
using VRTK;
[RequireComponent(typeof(VRTK_InteractGrab))]
public class InteractableObjectGrabHook : MonoBehaviour
{
[Tooltip("How long a complete move of the interactable object should take (in either direction).")]
public float Duration;
@bddckr
bddckr / DestroySystem.cs
Last active July 13, 2021 20:40
A small example on how to use the same kind of system for multiple contexts in Entitas 0.37.0(+).
using System.Collections.Generic;
using Components.Miscellaneous;
using Entitas;
using EntitasHelpers;
using JetBrains.Annotations;
public sealed class DestroySystem<TEntity> : ReactiveSystem<TEntity> where TEntity : class, IEntity, new()
{
private readonly Context<TEntity> _context;
private IMatcher<TEntity> _triggerMatcher;
@ryanc-unity
ryanc-unity / AsyncBundleLoader.cs
Last active August 22, 2022 14:55
Dummy object generator for project testing
using System.Collections;
using System.IO;
using UnityEngine;
public class AsyncBundleLoader : MonoBehaviour
{
// Used for visual debugging as to not generate unnecessary allocations
public GameObject worldLight;
// Private fields to keep track of loaded objects
@LotteMakesStuff
LotteMakesStuff / InspectorButtonsTest.cs
Last active November 10, 2024 13:09
Code running pack! two property drawing scripts that make it super easy to trigger code via buttons in the inspector, and get feedback! [TestButton] draws you little buttons that call a method on your MonoBehaviour, and [ProgressBar] give you a great way to show feedback from long running methods. These are *super* helpful for things like proced…
using UnityEngine;
using System.Collections;
public class InspectorButtonsTest : MonoBehaviour
{
[TestButton("Generate world", "DoProcGen", isActiveInEditor = false)]
[TestButton("Clear world", "ClearWorld", 2, isActiveInEditor = false)]
[ProgressBar(hideWhenZero = true, label = "procGenFeedback")]
public float procgenProgress = -1;
@PopupAsylum
PopupAsylum / CustomFramer.cs
Created January 24, 2017 11:41
Change how unity's 'F' framing is applied
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class CustomFramer : MonoBehaviour {
public float radius = 1f;
@LotteMakesStuff
LotteMakesStuff / CustomInspectorCreator.cs
Last active March 4, 2025 17:13
Editor extension that adds a tool to automagically generate boilerplate custom inspector code~ YES! Just drop it into a folder called 'Editor' and it adds a 'custom inspector' option into the Project window!
using UnityEngine;
using UnityEditor;
using System.IO;
public static class CustomInspectorCreator
{
[MenuItem("Assets/Create/Custom Inspector", priority = 81)]
static void CreateInsptorEditorClass()
{
foreach (var script in Selection.objects)
@aras-p
aras-p / SceneViewShowMips.shader
Last active January 8, 2025 03:03
Unity editor scene view "show mips" shader (as it is in 5.6 alpha)
/* C# code that sets up the mip colors texture:
s_MipColorsTexture = new Texture2D (32, 32, TextureFormat.RGBA32, true);
s_MipColorsTexture.hideFlags = HideFlags.HideAndDontSave;
Color[] colors = new Color[6];
colors[0] = new Color (0.0f, 0.0f, 1.0f, 0.8f);
colors[1] = new Color (0.0f, 0.5f, 1.0f, 0.4f);
colors[2] = new Color (1.0f, 1.0f, 1.0f, 0.0f); // optimal level
colors[3] = new Color (1.0f, 0.7f, 0.0f, 0.2f);
colors[4] = new Color (1.0f, 0.3f, 0.0f, 0.6f);
colors[5] = new Color (1.0f, 0.0f, 0.0f, 0.8f);
@aqaddoumi
aqaddoumi / gist:405d9abbcd4569fdce0cb9636e24dbf3
Created October 20, 2016 15:59
Game Controller for Clowny Rain
Systems createSystem ()
{
#if (UNITY_EDITOR)
return new DebugSystems ()
#else
return new Systems()
#endif
// ---------------- Create Systems ---------------- //