Skip to content

Instantly share code, notes, and snippets.

View hww's full-sized avatar

Valery (h2w) hww

View GitHub Profile
#if UNITY_EDITOR
using System.Reflection;
using UnityEngine;
using UnityEditor;
public class FontSwitcher : EditorWindow
{
[MenuItem("Font/Show Window")]
public static void ShowFontWindow()
{
@hww
hww / gist:c41d1d9d492c30c0c80dc2ddde8ab50b
Created October 6, 2022 19:34 — forked from KDawg/gist:10537524
Debug Unity3D OnGui Label Text With Background
// display a background texture banner
GUI.DrawTexture(new Rect(-30.0f, 384.0f, m_topScoreBanner.width, m_topScoreBanner.height), m_topScoreBanner);
Vector2 pivotPoint = new Vector2(Screen.width / 2, Screen.height / 2);
GUIStyle scoreStyle = new GUIStyle();
// DEBUG: create a background texture coloring the entire label background
Texture2D debugTex = new Texture2D(1,1);
debugTex.SetPixel(0,0,Color.grey);
debugTex.Apply();
@hww
hww / Draw.cs
Created September 26, 2022 17:37 — forked from nothke/Draw.cs
///
/// Draw lines at runtime
/// by Nothke
/// unlicensed, aka do whatever you want with it
/// made during Stugan 2016 :)
/// ..(it's midnight, and Robbie clicks A LOT, LOUDLY!)
///
/// Important:
/// - Should be called in OnPostRender() (after everything else has been drawn)
/// therefore the script that calls it must be attached to the camera
@hww
hww / DumpEditorTextures.cs
Created September 26, 2022 16:22 — forked from TarasOsiris/DumpEditorTextures.cs
Dump all Unity3d Editor GUI skin textures as images
using UnityEngine;
using System.IO;
using UnityEditor;
public static class DumpEditorTextures
{
const string AssetsFolder = "Assets";
const string TexturesDestFolderNamePro = "TexturesPro";
const string TexturesDestFolderNameNormal = "TexturesNormal";
static readonly string TexturesDestPathPro = Path.Combine(AssetsFolder, TexturesDestFolderNamePro);
@hww
hww / crc32.py
Last active August 19, 2022 12:33 — forked from aerosoul94/dc-disassemble.py
The Last of Us script disassembler
# Python
import os
import sys
def create_table(poly):
init=0
l=[0]*256
for i in range(256):
@hww
hww / NormalsVisualizer.cs
Created March 13, 2019 12:29 — forked from mandarinx/NormalsVisualizer.cs
Visualize mesh normals in Unity3D
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(MeshFilter))]
public class NormalsVisualizer : Editor {
private Mesh mesh;
void OnEnable() {
MeshFilter mf = target as MeshFilter;
@hww
hww / arcadia_demo
Created January 16, 2019 19:00 — forked from timsgardner/arcadia_demo
arcadia cube, vr demo
(let [ns 'clojure-west.demo]
(require ns)
(in-ns ns)
(use
'clojure.pprint
'clojure.repl
'clojure-west.freeze)
(require
;'[clojure-west.mesh :as mesh]
'[clojure-west.materials :as mat]
@hww
hww / StringToDouble.cs
Created January 10, 2019 09:49 — forked from samcragg/StringToDouble.cs
strtod in C# unit tests.
using System;
namespace SvgParser
{
/// <summary>
/// Provides methods to convert a string to a double precision floating
/// point number.
/// </summary>
public static class StringToDouble
{
@hww
hww / openGL_on_WLSS.md
Created November 29, 2018 13:38 — forked from campenr/openGL_on_WLSS.md
Developing openGL on Ubuntu on the Windows Linux Subsystem
  1. Install Ubuntu through the Windows store

  2. Enable rendering of GUI applications from Ubuntu/WLSS in Windows using a Windows X-server

  • Install VxSrv on Windows
  • On Ubuntu/WLSS open .bashrc and add the following lines to the end, then save file and restart:
# tell GUI display to use the Windows X-server listening on localhost:0.0
export DISPLAY=localhost:0.0
# make rendering happen on the Windows side of things rather than Ubuntu
@hww
hww / LayerMenu.cs
Created August 23, 2018 20:58 — forked from Minimally/LayerMenu.cs
Unity Editor script for filtering layers via keyboard
using UnityEditor;
using UnityEngine;
public static class LayerMenu
{
/* PLACE IN EDITOR FOLDER.
* Feel free to change hotkeys depending on your preference.
* Modifier Keys % (ctrl on Windows, cmd on OS X), # (shift), & (alt), _ (no key modifiers) */
#region Layer Visibility