Okay, it’s a different matter entirely - it’s a bug. It’s kinda complex.
The first time you load the blend file, if you press play and the replacing object isn’t onscreen, the material never updates. Every other time, it will.
In the standalone player, it’s basically always “the first time”, so unless the replacing object is onscreen when the game begins, the material will never update.
You can slide around this by printing something out about the source’s image, like:
import bge
controller = bge.logic.getCurrentController()
obj = controller.owner
if "RenderToTexture" in obj:
obj["RenderToTexture"].refresh(True)
print(id(obj['RenderToTexture'].source.image)) # < Prints out the Python ID of the image; doesn't really do anything, but somehow forces the engine to "remember" the texture and update it correctly.
else:
scene = bge.logic.getCurrentScene()
objList = scene.objects
matID = bge.texture.materialID(obj, "MAMaterial")
renderToTexture = bge.texture.Texture(obj, matID)
renderToTexture.source = bge.texture.ImageRender(scene, objList['RenderCam'])
obj["RenderToTexture"] = renderToTexture
Printing things every frame slows stuff down, so if you really want to just force ahead to make it work, then I would suggest adding a timer to make sure this doesn’t happen for too long - just long enough to “kickstart” the replacement process.
EDIT: To reiterate, I wouldn’t recommend using the hack above as printing things out can slow down the game. If you need the hack, add a timer to ensure the printing line only happens for a little while.
In any case, I’ve uploaded a bug report here.
EDIT 2: As a final side-note, I appreciate that you simplified your blend file, and I thank you for that. However, you could have simplified it a lot more - almost 100% of it was unnecessary. The point isn’t to remove an arbitrary amount, but rather to remove all of the extraneous elements - all of the stuff that has nothing to do with the bug. So, keep hacking away at the blend file until one more object removal gets rid of the bug, or until it’s just the bugged object itself, etc. Try to make it as simple as possible.
Again, thanks for the simplification, though.