The sprite is rendered with material_B indeed. But the issue is that vertex attributes with semantic type Position are not set in this case (and texcoords also).
Notice how sprite with material_B set in editor is rendered differently from sprite with material_B set from render script. position_local VA is zeroed in the later. texcoords though are set correctly in both.
The reason it doesn’t work is that components are not aware of the overridden material that has been set on the renderer, so it will not produce vertices in the format that the overridden material expects. I’ll take a look at a fix for it before next release, thanks!