Skip to content

Instantly share code, notes, and snippets.

@maoyeedy
maoyeedy / QuadSpriteProcessor.ps1
Created April 19, 2025 20:26
QuadSpriteProcessor-Powershell
<#
.SYNOPSIS
Make Textures Quad-Divisible
.DESCRIPTION
Resize PNG and JPG images so their dimensions are divisible by 4.
Useful for textures in game engines that require quad-divisible dimensions to be compressed with DXT or BC formats.
.NOTES
Requires ImageMagick to be installed and available in the PATH.
#>
@maoyeedy
maoyeedy / ChineseFontOverride.user.js
Last active April 9, 2025 09:23
[Userscript] Override font to 'HarmonyOS Sans SC' for Chinese sites
// ==UserScript==
// @name Change Font to HarmonyOS Sans SC
// @namespace https://github.com/Maoyeedy
// @grant GM_addStyle
// @version 1.1
// @author Maoyeedy
// @description Override font to 'HarmonyOS Sans SC' for Chinese sites
// @match *://*.nate.com/*
// @match *://*.huya.com/*
// @match *://*.douyu.com/*
@maoyeedy
maoyeedy / ClaudeSidebarToggle.user.js
Last active April 8, 2025 00:58
[Userscript] Toggles claude.ai sidebar with "Ctrl+\"
// ==UserScript==
// @name Claude Sidebar Toggle
// @namespace https://github.com/Maoyeedy
// @version 1.0
// @description Toggle Claude sidebar with a keyboard shortcut
// @author Maoyeedy
// @match https://claude.ai/*
// @grant none
// ==/UserScript==
@maoyeedy
maoyeedy / UnityAutoSave.cs
Last active April 29, 2025 21:48
[Unity] Autosave the modified scenes when exiting playmode.
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine.SceneManagement;
namespace Project.Editor
{
/// <summary>
/// Autosave the modified scenes when exiting playmode.
/// </summary>
@maoyeedy
maoyeedy / HideMetaFiles.cs
Last active April 23, 2025 20:04
[Unity] Hides meta files in Windows Explorer.
#if UNITY_EDITOR
using System.IO;
using UnityEditor;
using UnityEngine;
namespace Editor
{
/// <summary>
/// It runs after each assembly reload.
/// </summary>
@maoyeedy
maoyeedy / UnityManualRedirectTo2022.user.js
Last active October 19, 2024 19:23
Redirect old Unity docs to 2022.3 version
// ==UserScript==
// @name Unity Manual Redirect
// @namespace https://github.com/Maoyeedy/
// @version 1.0
// @description Redirect Unity Manual to 2022.3
// @author Maoyeedy
// @match https://docs.unity3d.com/Manual/*
// @icon https://unity.com/favicon.ico
// @grant none
// ==/UserScript==
@maoyeedy
maoyeedy / UnityDocsRedirect.user.js
Last active April 29, 2025 20:17
[Userscript] Redirect Unity docs to latest LTS version
// ==UserScript==
// @name Unity Docs Redirect
// @namespace https://github.com/Maoyeedy/
// @version 1.1
// @author Yidi Mao
// @license MIT
// @description Redirect old Unity docs to latest LTS version
// @icon https://unity.com/favicon.ico
// @match https://docs.unity3d.com/*/Documentation/**
// @run-at document-start
@maoyeedy
maoyeedy / MixamoRenamer.cs
Last active April 28, 2025 20:16
[Unity] Rename Mixamo animation clips to match filename
using System.Collections.Generic;
using System.IO;
using UnityEditor;
using UnityEngine;
public class MixamoAnimationRenamingProcessor : AssetPostprocessor
{
private static readonly HashSet<string> NamesToReplace = new()
{
"mixamo.com"
@maoyeedy
maoyeedy / UnityDocsHighlight.user.js
Last active April 29, 2025 20:21
[Userscript] Unity Document Syntax Highlight
// ==UserScript==
// @name Unity Docs Syntax Highlighter
// @namespace https://github.com/Maoyeedy
// @version 1.3.1
// @author Yidi Mao, hyblocker
// @license MIT
// @description Adds syntax highlighting to the Unity Documentation. Forked from hyblocker.
// @icon https://unity.com/favicon.ico
//
// @match https://docs.unity3d.com/Manual/*
@maoyeedy
maoyeedy / Set-UnityAssetStoreProtocolHandler.ps1
Last active April 4, 2025 23:02
[Windows] Fix Unity Asset Store "Open in Unity" button not working
$EditorRootPath = "C:\Program Files\Unity\Hub\Editor"
$versions = Get-ChildItem -Directory $EditorRootPath | Select-Object -Expand Name
$latestVersion = ($versions | Sort-Object -Descending | Select-Object -First 1)
$unityExe = Join-Path $EditorRootPath "$latestVersion\Editor\Unity.exe"
Write-Host "Try registering URL:com.unity3d.kharma for $unityExe"
Remove-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" -Recurse -ErrorAction SilentlyContinue
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore" | Out-Null
New-Item -Path "Registry::HKEY_CLASSES_ROOT\UnityAssetStore\DefaultIcon" | Out-Null