isReadable bug in Substance material

Hi all,

I have encountered an issue with substance materials.

When setting the isReadable property on a substance material to true

substance.isReadable = true;

then calling the GetPixels32 on a substance gives me the warning message

I tested if it is actually getting set to true using

Debug.Log("Texture readabity: " + substance.isReadable);

And it says it’s true… What?
:eyes:

Code:

    void Start ()
    {

        substance = renderer.material as ProceduralMaterial;       
      
        substanceTexture = substance.GetGeneratedTexture(substance.GetGeneratedTextures()[0].name);
        substanceTexture2D = new Texture2D(substanceTexture.width, substanceTexture.height, TextureFormat.ARGB32, false);
        substance.SetProceduralTexture("Hexagon_Heights", hexBiomeMap);

        substance.RebuildTexturesImmediately();
       
        substance.isReadable = true;
        Debug.Log("Texture readabity: " + substance.isReadable);


        substanceTexture2D.SetPixels32(substanceTexture.GetPixels32(0, 0, substanceTexture.width, substanceTexture.height));
        substanceTexture2D.Apply();
    }

This seems like a Unity bug. Unless I am missing something.

Use

 substance = renderer.sharedMaterial as ProceduralMaterial;

instead of just renderer.material and problem solved.