Skip to content

Instantly share code, notes, and snippets.

View GhatSmith's full-sized avatar

Ghat Smith GhatSmith

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")]
@yagero
yagero / ButtonSmartNav.cs
Last active March 18, 2024 06:39
Unity UI ButtonSmartNav
using UnityEngine.UI;
// Use this class instead of Unity's default Button
// to automatically skip disabled and inactive Buttons
// if you define your navigation as explicit
public class ButtonSmartNav : Button
{
bool CanReachSelectable(Selectable select)
{
return !select || (select.interactable && select.gameObject.activeInHierarchy);
@darkon76
darkon76 / AnimatedText
Last active February 19, 2019 09:43
UI Canvas. Animated conversation text.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[RequireComponent(typeof(Text))]
public class AnimatedText: BaseMeshEffect
{
[SerializeField] private float _waitBetweenLetters = .1f;
private CanvasRenderer _canvasRendered;
@rus89
rus89 / .gitignore
Last active September 2, 2018 18:42
.gitignore sample for Unity, Monodevelop, VisualStudio, VisualStudioCode on OSX, Windows and Linux OS, thanks to: http://midva.games/, https://play.google.com/store/apps/developer?id=Midva.Games
# Created by https://www.gitignore.io/api/osx,linux,unity,csharp,windows,monodevelop,visualstudio,visualstudiocode
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
@tomkail
tomkail / DefaultAssetEditor.cs
Last active August 21, 2024 10:41
Draws inspectors for any file type Unity doesn't draw by default
/// Used to draw custom inspectors for unrecognised file types, which Unity imports as "DefaultAsset"
/// To do this, create a new editor class extending DefaultAssetInspector
/// Return true in the IsValid function if the file extension of the file matches the type you'd like to draw.
/// The DefaultAssetEditor class will then hold a reference to the new instance of your editor class and call the appropriate methods for drawing.
/// An example can be found at the bottom of the file.
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
@LotteMakesStuff
LotteMakesStuff / PlayerLoop.cs
Last active September 24, 2024 06:38
Player Loop Visualizer: Built to explore the new PlayerLoopSystem api in Unity 2018.1b2. This tool shows you all the PlayerLoop systems that unity uses to update a frame, and demos how to add your own and even remove systems from the player loop. For more info see the patreon post https://www.patreon.com/posts/unity-2018-1-16336053
// Put this in an editor folder
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using UnityEngine.Experimental.LowLevel;
using UnityEngine.Profiling;
using UnityEditor;
using UnityEngine;
namespace Utils {
public class ScriptTemplateModifier : UnityEditor.AssetModificationProcessor {
private const string SCRIPT_LOCATION = "Assets/Scripts/";
private const string PROJECT_NAME = "#PROJECT_NAME#";
private const string FILE_PATH = "#FILE_PATH#";
@rstecca
rstecca / MakeA3DObjectDraggable.cs
Last active September 29, 2021 11:32
How to make a 3D object draggable in Unity3D
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
/*
MAKE A 3D OBJECT DRAGGABLE
Riccardo Stecca
http://www.riccardostecca.net
@LotteMakesStuff
LotteMakesStuff / NativeMeshTest.cs
Created August 8, 2018 00:30
[NativeCollections] How to copy a regular .C# array into a NativeArray suuuuuper quick using memcpy. its about as fast as its ever gunna get!
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Mathematics;
using UnityEngine;
public class NativeMeshTest : MonoBehaviour
{
private NativeArray<float3> vertexBuffer;
private Vector3[] vertexArray;
@karljj1
karljj1 / Unity Assembly Definition Debugger.cs
Last active April 2, 2025 23:06
Find out what assemblies are being built and how long each takes.
using System;
using System.Collections.Generic;
using System.Text;
using UnityEditor;
using UnityEditor.Compilation;
using UnityEngine;
[InitializeOnLoad]
public class AsmdefDebug
{