Compare two variables.

UnrealEditor_zzbSK5eU3A
So I’m trying to compare two “identical” blueprint structures (One is a duplicate of the other) and don’t know how I would do so, There is no Matches node like for individual blueprints, and the == node, as you can see, doesn’t work either.

I want it to reduce the workflow a little, basically it’s checking if they are identical, and if so, skip the step that determines stasis effects. As I have many ways to add/remove stasis effects, this was more efficent then running the function for each case.

You can either Break Struct:

Or split struct:

And then compare each field, do AND for all boolean results.
But if you have array inside it will be harder to make function.

There is hacky way in C++, but i am not sure how stable that would be:

  • get pointer and size to both structs.
  • make some crc32 sum of that memory
  • compare both checksums.

But that assumes unreal always generates same memory wise values for same structs. And i have sneaky feeling it happens in most cases but for some does not. Also since arrays in C++ are really lists, handling those would be another can of worms.

And you could do PURE function like this:

However this requires comparing two arrays (which should be separate function).

And resulting node:

1 Like

I was hoping for a less tedious possibility. My struct has atleast 26 (EDIT: There is 41) different outputs…
But if this is the only way, I’ll take it…
Thanks.

Split struct into sub-structs. Make final struct of structs.
And create blueprint function library put all those comparing functions there.

Also what for you need that comparing? Those structs probably can be replaced by data assets or data tables.

It grew into this. Originally it was 4 different effects, and it’s so deeply ingrained it’ll take a lot of time and effort just to replace it, when it already works fine as it is.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.