- Home /
Do material instances require manual cleanup?
Hi, So in my game when the player changes armour it alters the materials of the armour, and in certain circumstances it creates new instances of a material. I've done some reading and it seems like these might require manual cleanup, is this true? If it is true What call do I use to clean it up?
Also how much will NOT cleaning it affect performance if this is the case?
Answer by Zodiase · Aug 25, 2014 at 06:14 PM
Hi. I'm not sure if you've already found the answer, but I think this thread might help.
To summarize what I understand: it's of the best practice (at the moment) to clean up all materials you created dynamically (of course, those you are aware of). The reason for that is, materials are considered part of your assets and are never considered "unneeded" until they are force unloaded (when, say, the scene is unloaded). But the tricky part is that Unity internally may produce clones at certain points, some of which are mentioned in the thread above, but likely there are more you need to find out.
I hope this helps.
Cheers.