Latent Action Error at Execution

Hello,
I am trying to learn C++ for unreal for about 1 month and I’m pretty interested to do something that was not possible with Blueprint before. In addition to this, I made an asset for marketplace [ link ]; however as it grew complex I noticed that struct made on content browser don’t have any feature to expose to cinematics and also there were corruption issue upon editing a child struct. There is where I started to learn C++ for unreal.

Now for a few weeks, Timeline node in the BP just poking me on that fact that ANY NODE connected to the Update Pin would get updated; we don’t need to use delegate to fire the execution.

After spending time searching for similar feature which could be done via C++ and it would do same on BP side ; I came across " LATENT ACTIONs " .
All I wanted to create an actor component which could have a function which could keep firing an event/function on BP side linked to it’s outpin ( for instance, “Print String” ). I did found a posting which might be exactly what i want ; however he only showed the end result and did not show the .h file of his own latent action or the .cpp file of his static void function here is the link of the post →

It has been mentioned many times on other topics is that follow the " DELAY" function of BP and learn from it that how we can implement our custom latent action; I did so that these are attached to this post. I am also manage to make the exact node that was supposed to fire any node link to the update pin; however I’m keep facing crashes with the error message on the pic .

  1. latent action codes

  2. actor component codes


  3. error

could anyone kind enough to help me understand what i did wrong there??

1 Like

Can you try passing LatentInfo.CallbackTarget instead of this in your AddNewAction call.

Also your method is not static so you don’t need the WorldContextObject thing.

miracle it worked!! THANK you so much

one more thing;
could u tell me what is the tick level of the latent actions? PrePhysics?
this is what i would like to do =>

u can see sim_frwrd which is made in C++ and its located under .h file of the component
( gen_cmp_1_timeline ).
All i want is to some kind of method which could Run “Call X Evet” at prephysics level tick and maybe independent of tick as an alternative option. Could you please help me out?

Why don’t you make a component that ticks in Pre-Physics, and implement X in its event TickComponent directly ?

I’d do so however, as I said before it wont have the option for users to make event on blueprint and update it via that component function.

component function would return a float value out from that sim_frwrd node which a BP user would need. For instance think the the BP user have an event X which lerps location of X from A to B. Now my component would return float value 0 to 1 on its own tick which is running on pre physics ; however if i connect call X at the end execution pin ; it wont keep updating. This is why i went for latent as they can detect the node which is connected to its out execution pin.

Basically I want to find out how The Timeline component has “Update” node which can update the event on selected tick levels.

Latent nodes all rely on the ticking of LatentManager singleton. You cannot control its tick group.

Timelines are not latent node. They are entirely custom K2Nodes which, under the hood, translate into binding a custom event to the timeline component’s update delegate.

In short, this :

is translated (under the hood) to this :


Custom K2Nodes are tricky, but you can easily reproduce the latter version. Add a dynamic delegate or multicast delegate, and trigger it from your component’s TickComponent method. Then you can bind it to a custom event in the owning blueprint. And you can control tick group via the component’s tick group.

Something like this as a basic concept :

1 Like

Correction, each object ticks its own latent actions, so if you set PrePhysics tick group in your blueprint then the latent action should tick in the same group.

Except if you are using a TickInterval that makes the object skip some ticks. In that case the latent action will be ticked by the World whenever the actor is skipping ticks, in a group between PostPhysics and PostUpdateWork. So if your actor is ticking in PrePhysics with TickInterval = 1, then once every second the latent action would tick in PrePhysics while the rest of the time it would tick after PostPhysics, that could lead to some funky results.

2 Likes

Sorry for the late respons but im really after making that timeline style K2 node. Recently, i came to understand that k2 node have a call section where it can call functions. I will see if I can able to just reproduce the exact same functionality.