Changing a plane's material alpha from BGE python I want my scene to "fade in" from black when it starts up in the BGE.
For that reason I have created a plane (with shadeless, diffuse black material) in front of the camera that I want to make transparent by decreasing the alpha value.

(I connected a Python script to an Always sensor so I have a function that is called every frame; from there I set the alpha.)

However, setting the alpha does not have any effect.

plane = bge.logic.getCurrentScene().objects["blackScreen"]
plane.meshes[0].materials[0].alpha = 0.0 # just an example


The plane will always be rendered in the color (including alpha!) that was set in Blender.

Why does it not work?
you don't need Python to do that. You can animate the transparency and just play the animation. You can download the example blend belowor rebuild the setup from the screenshot below. In my case there is a fade in of 100 frames and a little bonus - the plane is destroyed when the fading is done.

 

. 

Enjoy!