In a game i am making im going to make a kind of landscape transformation, i want to keep it simple so im only going to change the coloring.
I have set up two materials:
MALightClouds and
MADarkClouds
I have figured out how to find these materials in my mesh via python but i could not figure out how to set them, am i using outdated code? other then the whole GameLogic thing i know thats old.
You may use replaceMesh, which will replace the materials if you replace the graphics mesh. it is frustrating that such elements are not writeable, but for now there is little we can do but suggest that somebody takes on the role of adding such functionality.
You could also use bge.texture to replace one of the active textures with one loaded from disk. But yeah, unfortunately, you can’t switch materials on the fly.
I’m also intereseted in that question, but still confused after search in the forum…
So, isn’t possible, although where saved in the project?
I have seen also some examples like x.setMaterial but guess is not working in actually API
but debugger response something like object hasn’t this attribute
Not really, no. You can swap textures (and also swap them on any duplicate meshes), or swap meshes, but not change materials. I’m not sure, but I’m guessing the setMaterial function is for Blender’s API, not for the BGE.