Using a custom property in if statements in the BGE
You debugged part of your problem in your code. You mixed blender's api (bpy), in with the game engine's (bge).

The line unit = bpy.data.objects["player"]["unit"] will do nothing in the game.
You already defined the scene in your script, so that line with bpy needs to be:

unit = scene.objects["player"]["unit"]


That line is accessing the game property "unit" on the object named "player".



Your last if statement is not correct. You need something in the if statement's bodies, even just pass will work.