How to change _MainTex and _DetailAlbedoMap unity webgl Addressables

First you need to enable _DetailAlbedoMap


than you need to change _DetailAlbedoMap and after that change _MainTex. It works fine for me.

Full code here:

private Material ChangeMaterial(Material material)
        Material newmat = material;
        newmat.SetTexture("_DetailAlbedoMap", material.mainTexture);  
        newmat.SetTexture("_MainTex", seamTextureAlbedo1);
        newmat.SetColor("_BaseColor", new Color(188, 188, 188, 255));
        newmat.SetFloat("_Cutoff", 0.05f);
        newmat.SetFloat("_Glossiness", .0f);    

        return material;

But this code works fine in unity editor and doesn’t work in webgl site – changing only _DetailAlbedoMap or _MainTex. i spenŠµ a several days to find the way and the way is create another material and put it in Addressables and after that loaded it in script, changing it where if you need.

Of course this is good for not so many materials. if you have many materials to change, this is not good method, more better to change material by code.

private void Start()

private void LoadAllSeamColors()

private IEnumerator LoadAllSeamMaterials(string path)
        var _loading0 = Addressables.LoadAssetAsync<Material>(path);
        yield return _loading0;
        if (_loading0.Status == AsyncOperationStatus.Succeeded)

public void ApplyNewThreads(Material material)
       thread.material = ChangeSeamMaterial(material);

//changing material
private Material ChangeSeamMaterial(Material material)
    {//find materials by name of _DetailAlbedoMap 
        return seamMaterials.FirstOrDefault(x =>       x.GetTexture("_DetailAlbedoMap").name ==;

Live a comment if you like!

Leave a Reply

Your email address will not be published. Required fields are marked *