I have a trouble setting normal map via script in unity. I have a normal map and I want to assign it to a material of the target object.
renderer.material = new Material(oldMaterial);
renderer.material.SetTexture("_BumpMap", normalTexture);
This line works for assigning the texture. But the target object's normal map is not updated until I open inspector and click material component. I can update albedo texture by using this technique and it works.
Is there a function to force material update its properties ?
Any ideas?
Try add that one:
renderer.material.shaderKeywords = new string[1]{"_NORMALMAP"};