Vertex / Fragment Shader problem

Hi :smiley:

Here’s the problem:

I create a simple cube mesh
Add a new material to it (Material Buttons->Add New), object’s name is ‘cube’

Have the following shader script, run by game engine:

import GameLogic
objects = GameLogic.getCurrentScene().getObjectList()
obj = objects["OBcube"]
mesh = obj.getMesh(0)
for mat in mesh.materials:
    # is valid Blender material?
    if not hasattr(mat, "getMaterialIndex") :
        break
    shader = mat.getShader()
    # assign shader here...

The mesh’s material is always cosidered as invalid and thus shader is never assigned.
Does anybody know what’s wrong?
Should I assign a material in some another way or it’s not about that?

Thanks