UGTK / Toolkit / Utility Systems / Texture Resizer System Completed
Texture Resizer System
Summary
An editor-only, destructive batch tool: it scans every Texture2D in the project and rescales the
ones whose width or height is not a multiple of 4, overwriting the source file on disk. It exists
because most GPU compression formats (DXT, ETC, ASTC) require multiple-of-4 dimensions and silently
fall back to an uncompressed format otherwise, inflating build size.
⚠️ Read the caveats before running it. It rewrites your source art. Commit or back up first.
Content
Modules Dependencies
None. A single editor-only class (#if UNITY_EDITOR).
Setup
Nothing to set up and nothing to show in a GIF: no component, no prefab, no scene. Importing the module adds one menu entry:
UGTK ▸ Resize All Textures To Multiple of 4 (Overwrite)
How To Use
Run the menu item. For every Texture2D in the project whose size is not already a multiple of 4 the
tool:
- makes the texture readable and uncompressed if it is not (re-importing it);
- computes the next multiple of 4 for width and height (
CeilToInt(size / 4) * 4); - blits the pixels into a
RenderTexture, reads them back and encodes to PNG; - overwrites the original file on disk.
Progress and a final count are logged in the console, then the AssetDatabase is refreshed.
What you have to know before running it
- It is destructive and has no undo. The source files are rewritten in place: run it on a clean
git working tree, so
git checkoutcan bring the originals back. - It rescales, it does not pad. The blit stretches the image to the new size, so a 101×101 texture becomes 104×104 slightly distorted. For pixel art, sprite sheets and anything with an atlas/slice setup this is destructive in a way you will notice — pad by hand instead.
- Everything comes out as PNG bytes, whatever the original extension. A
.jpgis overwritten with PNG data while keeping the.jpgname: Unity still imports it (it sniffs the content), but the file is now mislabelled, bigger, and confusing to any other tool. - The importer changes are permanent. Textures are switched to Read/Write enabled + Uncompressed to be read, and the tool never puts them back: check the import settings afterwards, because readable+uncompressed textures cost both memory and build size.
- Sprite metadata is not migrated. Slices, pivots and borders are set in pixels: after a resize they no longer line up.
In practice: use it on a folder of plain, freshly exported textures, review the diff, and prefer exporting at the right size from the art tool.
Testing Scene
This is an editor tool: there is nothing to play. Test it from Tools > UGTK > Texture Resize (preview).
What to do, in order:
- Press Scan the project (read only) and read the two counters: how many textures were examined, and how many are not a multiple of four. Nothing is written yet.
- Check a few of them by hand with the ping button.
- Commit your work, then run the resize and review the diff.
Step 3 is not a suggestion. The operation overwrites the source files and Unity cannot undo it, so a clean working tree is the only way back. That is exactly why the preview exists: the original menu command rewrote everything with no list shown first.
Technical Info
| Path | Content |
|---|---|
Scripts/Mn_TextureResizeSystem.cs |
Editor-only class exposing ResizeAllTexturesInAssets() behind the [MenuItem("UGTK/Resize All Textures To Multiple of 4 (Overwrite)")] entry |
Namespace: UGTK.UtilitySystems.TextureResizeSystem (note: TextureResize, without the r, unlike
the folder TextureResizerSystem). The console messages are in Italian.
© 2026 Marcello De Bonis. All rights reserved
UGTKengine within an engine


