Automatic texture importer not assigning alpha

I have written a custom texture importer, and put it in my Editor folder inside the Assets folder, which is supposed to apply my custom settings automatically when a new texture is imported to the project.

This is my code:

public class TexturePostProcessor : AssetPostprocessor
{
    void OnPostprocessTexture(Texture2D texture)
    {
        TextureImporter importer = assetImporter as TextureImporter;

        importer.textureType = TextureImporterType.Default;

        TextureImporterPlatformSettings settings = importer.GetPlatformTextureSettings("WebGL");
        settings.overridden = true;
        settings.name = "WebGL";
        settings.maxTextureSize = 1024;
        settings.format = TextureImporterFormat.DXT5Crunched;
        settings.compressionQuality = 50;
        settings.allowsAlphaSplitting = false;
        importer.SetPlatformTextureSettings(settings);
    }
}

The issue i have is, when the texture is imported, it doesn’t get the alpha channel, but if I manually right click and re-import the texture, then the alpha is applied. You can see that in below image:


Re-importing is not an option though because our textures will be coming in from external sources automatically, so it needs to have the correct alpha and format the first time.

Can someone point me in the right direction please?

Anyone?
I’d appreciate any hint to point me in the right direction.