Set Relative Transform in Construction Script breaks attachment

I have a Blueprint class with a static mesh component attached to the DefaultSceneRoot. When I create an instance of the Blueprint and move it around in the scene, the mesh that is part of it moves as well. (This is correct, and desired.)

When I add Blueprint code in the Construction Script that calls Set Relative Transform on the static mesh, it does the right thing (properly scaling and translating the mesh as desired, based on variables in the blueprint) but it breaks the attachment to the DefaultSceneRoot. When I translate the instance after hooking up the Construction Script, the static mesh remains in the same spot, no longer moving with the rest of the blueprint.

How can I use the Construction Script to change the scale and location of a mesh component that is part of the blueprint, and still retain the ability to move that mesh around by moving the blueprint instance itself?

If there is a more elegant way to set the scale, or to use a pivot offset so that the mesh is always stuck on the ground, I’m also interested in such comments.

Sorry, I could not reproduce the behaviour you described. The attachment to the DefaultSceneRoot is not broken by the construction script.

Here’s what I experience:

  1. Remove the construction script, select the blueprint instance, use the move to to drag it, watch the static mesh move, too.
  2. Add the construction script, adjust properties of the blueprint instance, see the static mesh resize (Yay!) but now use the move tool and the billboard sphere for the blueprint moves, but the static mesh stays at the origin.

I also couldn’t reproduce your issue.

Here is a more elegant way to get the mesh to stick to the ground (provided that the pivot is at the center)

Really helpful, thanks. FWIW, I tried running my project on Windows instead of OS X and the editor works as expected on Windows. I’ll close the question for now, and re-open once I can confirm that the behavior is broken. :stuck_out_tongue:

I cannot reproduce the issue at work, either (using 4.18.3 on Windows versus OS X). I’m going to say that either the editor was in a bad state, or something is broken on OS X. I’ll confirm when I get home.

(I’d just delete this question, but @sboochoon’s useful comment seems like I should leave the question up for others.)

Edit: FWIW, yes, the Editor was just in a bad state. When I closed and re-opened the project, the unexpected behavior was no longer reproducible.

Thank you for testing. As I replied below, I too cannot reproduce this behavior with the same project files on a new machine (running Windows vs. OS X). Not sure what was going on, will have to investigate more when I get home tonight.