Skip to content

Instantly share code, notes, and snippets.

View Harsche's full-sized avatar

Luiz Henrique Harsche Harsche

View GitHub Profile
@jschieck
jschieck / FlyoutProjectWindow.cs
Last active March 2, 2024 12:43
Show a flyout project window in the scene view
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.Compilation;
using UnityEngine;
public static class FlyoutProjectWindow
{
@yasirkula
yasirkula / ConvertTexturesToPNG.cs
Last active October 27, 2025 00:22
Convert all TGA, TIFF, PSD and BMP (customizable) Textures to PNG to reduce the project size without any quality loss in Unity
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using UnityEditor;
using UnityEngine;
using Debug = UnityEngine.Debug;
using Object = UnityEngine.Object;
@edwardrowe
edwardrowe / Git.cs
Last active December 7, 2023 03:13
Exposes Git commands to C#, intended for use in Unity as part of a Build Automation tool
/* MIT License
Copyright (c) 2016 RedBlueGames
Code written by Doug Cox
*/
using System;
using UnityEngine;
/// <summary>
/// GitException includes the error output from a Git.Run() command as well as the
@Arakade
Arakade / gist:9dd844c2f9c10e97e3d0
Created January 3, 2015 16:54
Call from OnDrawGizmos() to draw text at Unity3D glocal position in Editor
static void drawString(string text, Vector3 worldPos, Color? colour = null) {
UnityEditor.Handles.BeginGUI();
if (colour.HasValue) GUI.color = colour.Value;
var view = UnityEditor.SceneView.currentDrawingSceneView;
Vector3 screenPos = view.camera.WorldToScreenPoint(worldPos);
Vector2 size = GUI.skin.label.CalcSize(new GUIContent(text));
GUI.Label(new Rect(screenPos.x - (size.x / 2), -screenPos.y + view.position.height + 4, size.x, size.y), text);
UnityEditor.Handles.EndGUI();
}