# Updating all meshes in a scene is missing a crucial comparison of materials

**URL:** <https://forums.unrealengine.com/t/updating-all-meshes-in-a-scene-is-missing-a-crucial-comparison-of-materials/2652157>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [August 29, 2025, 3:35pm UTC](https://forums.unrealengine.com/t/updating-all-meshes-in-a-scene-is-missing-a-crucial-comparison-of-materials/2652157 "2025-08-29T15:35:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![FastFishy96](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@FastFishy96](https://forums.unrealengine.com/u/FastFishy96)\
**Post date:** [August 29, 2025, 3:35pm UTC](https://forums.unrealengine.com/t/updating-all-meshes-in-a-scene-is-missing-a-crucial-comparison-of-materials/2652157/1 "2025-08-29T15:35:31Z")

</div>

I have a button in a widget that when clicked changes the material of a single static mesh to a prescribed material and then back again to its original. I have a function that does this and this function works:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/3/1a33f2cf17128ee1c2f83c865589aadf55439b11.png)

However, I also have scenes that have some static meshes under them. When I click the button, I want all static meshes under that scene to change to the same prescribed material and then back again when clicked again. Even worse: some static meshes have multiple materials, which all need to be set to a prescribed material (hence I need to loop through the materials as well).

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/5/2/e526d9d7a6305ece88da0370ddc0670302f5c615.png)

This also works. The problem however is that right now I’m using a boolean that flips everytime the button is clicked, which handles the branch to be True or False. This is a function that I want to use for multiple buttons with different secnes (which is why the scene is given as input). If I now click Button 1 and the mesh changes, that would mean that the boolean is flipped so when I click Button 2 nothing really happens, only on the second click. Imagine this with more than just two buttons.

One option I have is to give the boolean as input as well, but then I get quite some boolean variables, so I try to avoid that. Also, the function for the single static mesh does work without a boolean.

The other option is to compare the current material with the default material and determine True/False based on that. I wrote the following for that:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/c/a/3ca1d4ea79b0e6ec73ca6c12c1fe9d63c41ddc31.png)

This does not work: it’s never True. Hence something is wrong in the material comparison but I’m not sure what it is. I know the materials are objects, so if I’m right that means that the object references are never the same. This would be a more suitable solution to the problem I think.

Does anyone know what I’m missing here?
