Remove material instance after use?
Hi, I'm creating dynamic grid meshes in my level based on the user click location. I'm changing their material color from blueprint based on the distance from the player. I create material instances as soon as I spawn these grid meshes, with different vector parameters for color. Later when the user clicks on a new location, I destroy these meshes. What I want to know is whether these material instances will get removed from memory when I destroy the mesh actors? Or do I have to remove them explicitly in some way?
Here's a screenshot of what I'm doing in the blueprint:
Hey Stormrage256 -
Assuming that you are just deleting the mesh and not the whole blueprint that has created the MID (Dyanmic Material Instance) then you will still have the MID in memory but unreferenced. It should not hurt anything as it is part of the memory footprint of the Blueprint itself. Of course, it would also not hurt anything to remove the MID either. Typical garbage cleanup would take care of the MID if you removed the entire blueprint.
Hopefully that helps you out -
answered Jan 30 '15 at 03:15 PM
Lovecraft_K ♦♦ STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here