Download

Strange bug with Set Static Mesh function

Hello. I am making powerful equipment system for my project and i have problem. Let me show you, because explanation of this… problem may take a lot of time.
Here is my scene:


Pay attention to chest and sword and other item on background. They are THERE. Now let me equip sword from my inventory to it’s slot. It is Static slot.
It is attached to the hand socket. When we equip item, it is equipped by Set Static Mesh bp function. Let’s equip it.

pic2.PNG.jpg
as we can see it is worked and everything is set.
Ok. Let me unequip it now.


And… All items that had static mesh slot just Removed from the scene at all. As you see there is no sword, no anything.

To unequip i use this code:
pic3.PNG

and you might say that this is because of my mistake, like multiple call for set static mesh function. But it is not. I am never used trace for objects. This different object do not have any common parts. Even static slot names on them are different.
I checked in debug mode how many times it will call Set Static mesh. And it does it once. as it should be.

For the test i made this simple code inside of my character BP:

And… how do you think… does my bug disappeared? NO. It is not. Here how looks my scene after pressing R.


No chest. No sword. All actors that had Static Mesh slot just reseted this slot. I don’t know why.
All my day i am trying to underestand what’s wrong. And now i certainly tell - this is unreal engine’s bug. I am using 2.25 version with latest update on it(2.25.1). I never seen bugs like this before.
Here is how my actors structure looks like.

pic7.PNG

Here is how my character looks like(part of it, there is more than 24 different slots)
pic8.PNG
No common parts, no global variables at all. No game instance class at all. (in future, if i will make loading screen, it will be, but not now)

pic9.PNG

No set static mesh loops. As i shown yoou before it resets all static meshes even by key press!

And that bug works even with other static mesh attachments. for example with static hair mesh attachment.


if i remove it from there this will happen:

It’s just Impossible!
Can anyone help me with this, please. Because… i have to use static mehs component attachment on my character. It’s impossible to continue development like that.

ok here what i got after some LONG work. I don’t know why but Set Statc mesh with empty mesh value inside character_bp somehow triggers End Overlap event of item bp class. How?.. who knows
pic12.PNG
This event getting called right after Set Statc mesh (Empty)

Ah! I KNOW why it is douing this.

Probably… my static character equipped meshes interpreted by Engine as standalone actors. And when i hide that meshes they trigger overlap event…
But they should not do this! Ok… that’s fine i can simple set trigger overlap events = false on every character item that i gouing to unequip. Simple this way…

And IT WORKS. That is great. I wasted on this a lot of time. Now i can make it even more portable like that:


AND… this is not working (
Overlap event stil getting triggered… hm. what can i possible do with tihs? Go to all my static mesh slots and disable that trigger manually by hands? But this will … this will… i dont like this way because it will affect universal usage of my system. So need to find other way to disable that overlap event.

ok this is solved i just used mesh->get_children_components - Foreach of them -> set Generate Collision Overlap to False and put this after Begin Play.