Download

Is it possible to make a C++ PLUGIN that ticks?

Hi! I am making a plugin in C++ (struggling with it because I am pretty newbie in C++ and involves java) and I wonder if is possible to have a tick function inside the plugin because I have to update things and the only workaround I am finding is creating an Actor as wrapper but I am having crashes when loading new levels because the actor don’t persists, etc. So if I could make some ticking function inside the plugin would help a lot!

“Tick,” itself, is a concept of the World, and thus is inherently an actor-level thing, not a subsystem/plug-level thing.

To do things “on the side,” you can override UGameInstanceSubsystem or perhaps UEngineSubsystem.
When being created, register for appropriate callbacks.

Now, if you need to “update things” synchronously with the game (one update per game tick) then you really should create some kind of actor or component in the game, that calls into your subsystem to do the update. E g, have the game opt-in to driving your subsystem when it actually uses it. Presumably you’ll need some API to talk to it to get the results out, anyway, so an ActorComponent could work fine for that.

If you just need things to “update once in a while,” look into the worker queue / scheduled task system, which uses asynchronous threads, or the base FRunnableThread class.