How to check if static mesh component's mesh is = to a mesh?

Is Valid … if a reference/variable is empty/null, is valid will return false.

Post your code.

I have a static mesh component. It’s mesh is dynamically set, when it is set, I want to then check to see what “type” it is.
I do this by checking it’s mesh against other types. Just an = and a bool.

If I print string before the bool it says it is mesh type ‘1’, the bool is setup to detect if it is = to ‘1’. But it always returns false. Even if I follow along in the breakpoint viewer it will have no value on the Component Reference get static mesh.

Is there something wrong I’m doing? I merely wanna get the static mesh reference and check it’s mesh against many different types, for now I just want it to work with 1 possible type lmao.

Any help appreciated.

Edit: I didn’t realize you get component ref and then have to get static mesh then compare, I was under the impression simply dragging off the getter of the component would be enough. Solved…Keeping this up for posterity as my initial googling didn’t allow me to come to this conclusion.

I used to do this kind of thing, but looking back I’d say it’s not a good idea. You end up doing things like comparing materials as well and it leads to really convoluted code.

It’s much better to just have the meshes in an array and just compare array index.

I didn’t realize you get component ref and then have to get static mesh then compare, I was under the impression simply dragging off the getter of the component would be enough. Solved…Keeping this up for posterity as my initial googling didn’t allow me to come to this conclusion.

I didn’t realize you get component ref and then have to get static mesh then compare, I was under the impression simply dragging off the getter of the component would be enough. Solved…Keeping this up for posterity as my initial googling didn’t allow me to come to this conclusion.

This is also a viable solution, I ended up figuring it out, but yeah if I’m comparing more then a few things I almost always go for an array. Thanks for your time anyways man :slight_smile: