Hey there, I currently have a WaterBodyCustom on a Level to simulate a very still river on a Unreal 5.4 project. I need to change the color of the water body programmatically, meaning that a player does actions to trigger an event on this water body to change its water color (to simulate a river getting polluted, or cleaned) or its material (that has a different color). I’ve search all web for directions on how to do this but so far no luck… Dynamic Mesh Instances are not my strongest skills, so I’m kinda lost if I had to use that option. Any good ideas on how to achieve this?
I’ve used water bodies but not changed them at run time. I’d assume the general approach is like any other material that gets changed at run time:
- I think the water body material is in the engine content, so dupe it, and move the copy to your project
- add variables to your new material copy and make sure your water body is using it
- then change the variables on your water body material instance at run time
It works! I didn’t followed the exact steps (what I made differently was to get the Instance inside my Level and use the “Convert this actor into a reusable Blueprint Class that can have script behavior” button (this is located on the right of the Add button on the details tab when having the actor selected on the level editor)
After that I just built the logic to change the water material, works just as expected, thanks @Shmoopy1701! Now I need to make a fade transtion from one material to another, but that is another thread
Nice work.
Probably just make a custom single layer water material to use, add an MPC into it, and use that on the water body.
The MPC is what you really want to be able to control things from anything.