Fixed leaking materials by deleting them with a static cleanup function instead of individually releasing them when tearing down gameobjects.