Randomize material on Spawn Objects

Perhaps someone can recommend a guide to creating the material. There are spawn objects ( Blueprint Cars for simple traffic generator ) it is necessary for the materials on the body of the car to change during when Start Play, the materials must be taken from pre-created sets of materials. Or they simply randomly selected colors from previously created ones. It is necessary when we press Play and the cars appear - they appeared with different materials. Thank you.

Greetings @aerickson1986

Welcome back to the Unreal Engine Forum! To be clear, the issue that you’re having is when you have the cars spawning that they’re spawning with the wrong materials. Is this correct? If so, is it duping the same material over and over(A material from your preset selection) or is it a material from something else? Thanks!

A quick way to do a random select materials.

You are most likely right, there is duplication of material. But it will also happen when you spawn any other objects in the scene with the same material

Thanks for the tip - it works. But is it possible to link this blueprint to another blueprint that contains a static mesh of the machine body that should change the material. At the moment, your blueprint in the scene changes colors, but it does not change the color in the static mesh that I pointed to in another blueprint

Sorry. Perhaps there is a blueprint that would change a certain material for certain other materials from the set at the begin play event? For example. I assigned one material to different objects, and blueprint will randomly change the materials on all objects when play

I see! Was something like this thread what you’re looking to do? BP that assigns random material?

Does this work for you?


Just creating a material array variable and getting a random material from it.

You could also store the material array variable in your game instance instead of the character so you can retrieve it in any character, bp etc.