Hello!
I’m attempting to add events to call from external systems into Control Rig (via the Control Rig AnimNode), and I noticed what appears to be a bug with RequestRunOnceEvent(). Once I add a name to the queue, the event triggers appropriately, but it runs more than just the once as the name implies.
I noticed in UControlRig::Execute that only FRigUnit_PrepareForExecution::EventName and FRigUnit_PostPrepareForExecution::EventName are removed from the queue. Locally, I changed that to:
// Old
//if(bIsConstructionEvent)
//{
// RemoveRunOnceEvent(FRigUnit_PrepareForExecution::EventName);
//}
//if(bIsPostConstructionEvent)
//{
// RemoveRunOnceEvent(FRigUnit_PostPrepareForExecution::EventName);
//}
// New
RemoveRunOnceEvent(InEventName);
(I noticed the same in URigVMHost::Execute, but since I’m not using that directly, I didn’t make any edits there.)
Are there any knock-on effects this might have? Or is there a better way to call events from external systems?
Thanks!
-Nathaniel
[Attachment Removed]
Hi Nathaniel,
I’m checking with the dev team on expectations for whether RequestRunOnceEvent should be used externally, outside the engine/control rig code. But considering it’s a public method, it does seem problematic that the events aren’t removed after being run. I’ll follow up once I have more information for you.
In terms of your specific use case, are you trying to trigger an existing event, or have you added a custom event?
Thanks,
Euan
[Attachment Removed]
Thanks Euan!
In my specific use-case, I’m adding a custom event inside the Control Rig so I can call some specific functionality from gameplay. If there’s a better way to handle this kind of situation, I’m definitely open to suggestions!
[Attachment Removed]
Hi, sorry for the delay getting back to you on this. There’s been quite a lot going on here over the last couple of weeks, obviously.
I’ve confirmed with the dev team that adding custom events like you mentioned, is a valid approach and that the change you applied is reasonable. I’m going to get a fix for this into the 5.8 release.
[Attachment Removed]