How to control the display and hiding of corresponding models based on materials


It can be achieved when a model corresponds to one material, but what should be done when a model has multiple materials,For example, in this picture, the model has multiple materials, and if you want to implement a switch for the materials, the model that uses this material will be hidden when it is turned off,Thank you.