Last active
November 16, 2024 13:09
-
-
Save 4liceD/d446fcbacaccde0527aefb925e1c8bb9 to your computer and use it in GitHub Desktop.
Unity Editor Script, Enables Streaming MipMaps for all project textures and sets priority to 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Written By Sonnet 3.5 | |
//I take no responsibility if this script breaks your project or causes data loss | |
//Enables Streaming MipMaps for all textures and sets priority to 1 to be above vrchat avatars | |
using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
public class TextureStreamingEnforcer : EditorWindow | |
{ | |
[MenuItem("Tools/Textures/Enable Streaming Mipmaps")] | |
public static void EnableStreamingMipmaps() | |
{ | |
string[] guids = AssetDatabase.FindAssets("t:texture"); | |
int totalTextures = guids.Length; | |
int processedTextures = 0; | |
foreach (string guid in guids) | |
{ | |
string path = AssetDatabase.GUIDToAssetPath(guid); | |
TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; | |
if (textureImporter != null && textureImporter.mipmapEnabled) | |
{ | |
textureImporter.streamingMipmaps = true; | |
//Unity Default 0, enforced 0 for vrc avatars | |
textureImporter.streamingMipmapsPriority = 1; | |
textureImporter.SaveAndReimport(); | |
processedTextures++; | |
EditorUtility.DisplayProgressBar("Enabling Streaming Mipmaps", | |
$"Processing texture {processedTextures} of {totalTextures}", | |
(float)processedTextures / totalTextures); | |
} | |
} | |
EditorUtility.ClearProgressBar(); | |
Debug.Log($"Enabled streaming mipmaps for {processedTextures} textures."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment