I put a blank white board on a wall and then duplicated it. My goal is to have a different material applied to both boards randomly every time I press play. I’ve figured out how to do that but not quite. The problem is that the material is only applied to one board and I want a material to be applied to both boards every time i hit play. How can that be done?
Hi @abc115588,
Here’s an example of how you would set this up in a blueprint:
Keep in mind though that this involves loading all arrayed materials as references for this blueprint. This won’t be a huge deal since you’ll be using all of the references anyways, but just something to keep in mind.
In this example, you create an array of materials, then add indexes for every different material type you might want assigned. When we set the material on the static mesh, we’ll want to read from an index along this array. By getting a random number, every instance of this blueprint should return a different random index. We could set the random int maximum, but why do that when you can find it procedurally? By getting the array length - 1, we get the last index in the array (since array starts on 0)
Good luck! Let me know if you have any more questions.
first of all when you say different material, is it just different color or different textures.
1-In both cases you create your material and make sur the color or Texture converted to parameters.
2-Create a Parent blueprint Board in which you add your static Mesh and Material. then in construction script you create Dynamique material instance and shuffle the color parameter of your board.
3- create child blueprints of your board (or duplicate), place in your level and test .
What i have is just images from Google that I made a material from, And by looking at the image you posted, I got what I wanted., but there are two problems, the first is that sometimes one of the two boards appears blank without material on it and I don’t know why? The other problem is that sometimes the same material is applied to both boards at the same time. I made 30 materials and I don’t want one material to be applied to two boards at the same time. I want each board to always have a different material than the other.
For a better understanding, here is an image:
Note: I’m using Version: 4.27.2
you don’t need to create 30 materials, just one is enough. in the blueprint you only change the texture.
if you are using textures(images) in the above solution replace color with Texture and convert to parameter.
in your blueprint you make an array of those textures(images), then get random item and set to Texture Parameter.
if you don’t want the boards to have the same material you should probably have the two boards in the same blueprint.