Updating a MaterialInstanceActor via unrealscript?

I have a MaterialInstanceActor in my level referencing a material I’m using for my skybox.

When the level loads, I find the MI actor and replace the material instance constant (so I can make edits to it):



foreach AllActors(class'MaterialInstanceActor', matInstActor){
    if (matInstActor != none && matInstActor.Tag == 'MaterialInstanceActor_SkyShpereStormClouds') {
        //Create and set a new material instance so we can make changes through script.
        StormCloudsMatInst = new(self) class'MaterialInstanceConstant';
        StormCloudsMatInst.SetParent(matInstActor.MatInst);

        matInstActor.MatInst = StormCloudsMatInst;

        StormCloudsMatInst = matInstActor.MatInst;
        break;
    }
}


The problem is that making changes to StormCloudsMatInst doesn’t update the material displaying in game.

If I don’t replace the material, then I can make edits to the material, but then I get errors:

Are MaterialInstanceActors only supposed to work with matinee or something?

I think you’re only supposed to modify material instances that get created during gameplay. UDK will complain at you if you modify a material instance that was created and saved in the editor, then cooked into a map. Nothing really bad happens if you do it. Worst case scenario is that you load a map containing that instance, and it has default values. I’ve been modifying material instances in UnrealScript for probably about a year now, on dozens of material instances at a time, to handle my day/night cycle. I haven’t seen any real problems because of it. I just have to DisableAllOnScreenWarnings (or something like that), and it goes on working just fine.