GetWorldLocation in construction script return 0,0,0 for components

Hello, i don’t know if this is a bug or if it’s normal but if i use GetWorldLocation or GetRelativeLocation in a construction script in within a BP owning this component, the result will always be the default location of the component in the BP, not the values that was modified in an instance of this BP in the level. If i call this from an other actor then the values are corrects. It seam that at construction script time locations of components are not set yet.

do they have different values if you check them a few seconds after they are constructed?

Sorry i didn’t see your comment.
:slight_smile: This is the problem, i think yes but how can we “check a few seconds later”?? It was my first idea, to add a delay after the “construction script” node but it does nothing at all (and i think it’s normal, delay is a runtime thing).

Maybe try the BeginPlay event, since that fires after the constructor AND after the object has finished being spawned into the world ( at least I think it does ). Maybe you won’t even need a delay

At runtime it’s ok, the problem is in the editor (construction script), currently i have this configuration :

  • Top down style but with fixed camera positions, a lot’s of them because it’s a 3D mobile game and camera is an important part of my gameplay.
  • for help me to place all these cameras, i use one “target” per camera, the camera look at the target.
    It is working, if a select the camera, use the pinlock in the camera view and select my target actor, i have what i want : be able to move the target while looking through the camera.

But at some place i have 3 or more of them very close and when i need to adjust, i need to found who is with who (group is nice but borring, need to ungroup for adjust etc, i currently just parent them and it’s not perfect).

That i wanted was to be able to have just one blueprint with my camera component and my target component and then, have 2 times less actor to add/sort/link…etc. And something nice is that when you click on an actor, if it contain a camera, the camera view is enable and you have a shortcut to move it (even if you don’t select the camera component itself). So for me that should realy be a big help, i select the actor, move the camera where it should be, select the “target” component and move it to adjust the camera view.
It’s why i need that to work in Editor. I don’t need it at runtime. But yes at runtime that work (if i remember good).

As you see It’s not a realy big problem i can work without that but for this question i was wondering if it’s normal or if it’s a bug, or even if this is my fault (a setting somewhere that implies this behavior).
Thank you for your interest.

That makes a very big difference. Sorry I assumed it was a runtime not editor thing.
I wonder if it’s something as simple as needing to call the parent constructor before querying the location?