Hi all.
I have a lot of Materials, that have a Albedo Texture assigned. Now i need to connect these Textures to the Secondary Map “Detail Albedo x2” and delete the Texture from the Albedo.
Is there a way to do it in Unity, without do it manualy for every Material?
somebody knows a script?
Select all your materials, then run this code from the Assets menu
using UnityEngine;
using UnityEditor;
public static class MatReplacer
{
[MenuItem("Assets/Move Albedo to Detail Albedo x2")]
private static void DoStuff()
{
foreach (var obj in Selection.objects)
{
if (obj is Material == false) continue;
Material mat = obj as Material;
mat.SetTexture("_DetailAlbedoMap", mat.GetTexture("_MainTex"));
mat.SetTexture("_MainTex", null);
}
}
}
1 Like
cool… so easy ?!
i have to learn scripting 