Download

Weird behavior when adding child actor component as a macro or function

Hi, I’m trying to generate a floor out of planes, I’ve mostly made it but when I try to encapsulate the part when I add the child component and assign the mesh into a function or macro, I get weird results.

  • The first image is the way it should look (and the way it looks after I restart the editor).
  • The second image is the code, when it’s not in a macro or function it just works.
  • The third image is how the object looks when I encapsulate the code, for some reason, sometimes where it should add one of the meshes it ends up by adding the other one.

The weird thing is that generating the floor (horizontal meshes) and generating the walls (vertical ones) are made in two different loops (the walls loop is inside the square one), so there shouldn’t be any reason to change meshes.

I can solve this by simply leave the code untouched (as messy as this is), but I’d like to know if this behavior is normal and why is happening.

Thank you.

EDIT:
It seems that the problem is using the mesh as a variable for the macro or function, once I use a macro without the mesh input, it works.

Anyone knows why passing a mesh as a variable creates these problems and how can I avoid them?