#hey all, quick question
1 messages ยท Page 1 of 1 (latest)
Hi Liquos ๐
I'm pretty new to Unreal C++ myself so grain of salt ๐ง
But; is OnConstruction the firing event you actually want? A quick google says "it's called whenever the actor is constructed or modified within the Unreal Editor. This includes changes to the actor's properties, components, or hierarchy".
That phrasing makes me think as other actor properties change, your logic reruns and continuously moves all of your objects. Is what you actually want something like OnBeginPlay()? Or to define an actual constructor, like MyClassName() { ... } ?
Hey, thanks for replying.
Its more of a workflow/tool automation so I do I want it to happen on construction (its not for gameplay).
When an artist places or moves an actor, that actor does some stuff, and updates all its instances. This works fine in my BP graph.
I can't use the actual constructor because I don't believe some components are registered with the world yet at that stage, so it would just crash if I tried to set my instance transforms.
The thing is, "construction script" is exactly the behaviour that I want. I thought "OnConstruct" is the same, just in C++, but apparantly the two are different
Is it maybe possible then to rethink the solution to your artists' problem?
i.e. instead of adding 10 to the existing z coordinate, define a reference point and derive the object's location by adding 10 to that starting coordinate?
Or, a silly idea - maybe you could add a bool flag to say an ISM component has/has not been moved by the editor script, yet. Then only tweak the position of the ones that haven't been moved.
Lastly, maybe some well-placed debug logs could confirm that the event firing order is happening as you believe it to be and there's a difference between bp and OnConstruction, maybe the logs can help you identify the timing issue
๐ค
Short of these ideas, I hope someone more familiar with this callback will chime in ๐