How to give my Ai unique dynamic materials?

Good sunday fellow devs,

I have a playable ship, ship has a thruster that changes emissive brightness when I pull the gamepad trigger. I set this up using a material > material Instance > material parameter collection.

The problem I am having is that the Ai (multiple ships up to 40) are duplications of my ship and share the same thruster material. This means that I pull the trigger and light up my thruster, so does in unison the fleet of Ai.

How do I allow each Ai to have its own material instance collection logic? Rather than create 40 unique material sets in the content browser and assigning directly, is it possible to generate a unique thruster material on begin play/construction script?

Many Thanks

From your description I think the issue is that your material’s emission value is driven by the material parameter collection, which means that any change made to the material parameter collection affects all materials. This is actually one of the intended uses for material parameter collections, to serve as a centralized source that drives the properties of many materials at once. If you want to have each ship retain its independent emission value then instead of using a parameter collection first expose Emissive as a parameter in the ship’s material, then call Create Dynamic Material Instance in your ship’s blueprint constructor, and use Set Scalar Parameter Value to modify the Emissive parameter. Hope that helps.

Yes! Thank you, so simple but until someone shows you, even the basics can be trouble. works perfectly and looks cool too :wink:

Awesome! Glad you figured it out :slight_smile: