Text object alpha BGE python for fade in/out 2.79 I am working on a "display name" with a text object added from a inactive layer to the current scene.

I startet just changing the visibility, then i wanted a "scaling visibility". For that (since the base class of the text object is game object) i try texObj.meshes[0].material[0].alpha but found that there is no meshes.

Then i put a plane.color =[0,0,0] behind the text and meet the colors (text.color=[amount,amount,amount]), amount = amount + or - 0.02 between 0.0 and 1 to slowly make a "scaling visibility" of the text, But this requires the plane as background of the text which i want to not use if there is a way to do it without a background.

Also i have google "bge python text to mesh" trying to found a way to convert the text to mesh so i could add the text object then edit,remesh,show,hide, endObject but only found the bpy reference which not work in bge runtime.

And of course a dont want to convert the text to a mesh (Alt+C) since i will unable to change the text.
Animate the alpha of GameObject.color

Tested using gamelogic module template, with a mouse sensor on text object. Clicking 10 times makes the text object "fade away".



def main(cont):
    own = cont.owner
    # color vector xyzw  ~ rgba
    own.color.w -= 0.1
    own.text = str(own.color)