Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Material and Texture Changer v1.0.1
sonic.dll
Decompiled 3 weeks agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("sonic")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("sonic")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("98f6da0c-f28e-4d99-a81d-92f0e99ae946")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.feralelf.materialroulette", "MaterialRoulette", "1.4.0")] public class MaterialRoulettePlugin : BaseUnityPlugin { private List<Material> allFoundMaterials = new List<Material>(); private void Update() { if (Input.GetKeyDown((KeyCode)103)) { ShuffleWorldMaterials(safeMode: false); } if (Input.GetKeyDown((KeyCode)104)) { ShuffleWorldMaterials(safeMode: true); } } private void ShuffleWorldMaterials(bool safeMode) { allFoundMaterials = (from m in Resources.FindObjectsOfTypeAll<Material>() where (Object)(object)m != (Object)null && (Object)(object)m.shader != (Object)null && !((Object)m).name.Contains("Internal") select m).ToList(); if (allFoundMaterials.Count == 0) { return; } Renderer[] array = Object.FindObjectsOfType<Renderer>(); Renderer[] array2 = array; foreach (Renderer val in array2) { if (safeMode) { if (((Component)val).gameObject.layer == 5 || ((Component)val).gameObject.CompareTag("Player") || ((Component)val).gameObject.layer == 8 || ((Component)val).gameObject.layer == 9 || ((Object)(object)CameraUtils.Instance != (Object)null && (Object)(object)CameraUtils.Instance.MainCamera != (Object)null && (Object)(object)((Component)val).gameObject == (Object)(object)((Component)CameraUtils.Instance.MainCamera).gameObject)) { continue; } string text = ((Object)((Component)val).gameObject).name.ToLower(); if (text.Contains("skybox") || text.Contains("postprocess") || text.Contains("vignette") || text.Contains("glitch")) { continue; } } try { Material val2 = allFoundMaterials[Random.Range(0, allFoundMaterials.Count)]; Material[] array3 = (Material[])(object)new Material[val.sharedMaterials.Length]; for (int j = 0; j < array3.Length; j++) { array3[j] = val2; } val.materials = array3; } catch { } } ((BaseUnityPlugin)this).Logger.LogInfo((object)(safeMode ? "Safe Shuffle Applied." : "Total Chaos Applied.")); } }