Randomizing Skeletal Meshes In Editor

I have made a button that appears in the details panel to randomize my NPC’s clothing, It works but when I change anything else in the details panel, the clothes change as well even though I did not click the button. Is there a way to stop this and have only the button randomize the clothes?

I see you’re setting that up in the ConstructionScript.

You probably want to move that to a Function, or just make a Function that sets a bool to true, and then once it runs on the ConstructionScript it is set back to false so it doesn’t run again.

Also, I assume you have it running on true and false for testing? you only want to run that on true. otherwise it will always run.

It’s a lot closer to what I want, but it’s not quite there. I transferred the blueprint to a function, then ran that function in the construction script, then set the bool to false. Now if I randomize the clothes in the details panel, it still works, but if I change anything else in the details panel or even move my NPC, the clothes (except for the shirt) reverts back to the default skeletal meshes. I am assuming the shirt doesn’t change as that is the default mesh component that comes with any character blueprint. I will add videos of what is happening so you have a clear understanding of my issue.

That actually makes sense =P
When the true path is not run, the the actor is constructed as default.

You need to:

  1. Create a variable to store the value you pick randomly.
  2. From a Branch: update the variable with a random value if ‘RandomizeClothes = true’
  3. And finally; set the mesh from that variable.

This way the mesh will always be set to the value of the variable, but the variable value will only update randomly when you press the “Set random” button.

Super simplified, but it would look like this:

I managed to do it, I think this is what you were getting at in an earlier post but I didn’t understand it at the time. I put everything in a function and checked call in editor in the function details panel. I didn’t make the RandomizeClothes variable false at the end though. I think the construction script was the problem.