I have a class containing a skeletal mesh component. I have several hundred instances of this actor class in a scene. For optimization purposes, I only allow most of the skelmeshcomponents to tick at about 2fps/0.5ms, hiking them up to full speed right before animating them, which happens only occasionally.
Currently, if I want to do anything with them, I need to use a timer to wait 0.5ms before doing anything to them, as their animations will skip horribly at the slow speed. Setting their tick interval to 0.0ms will not take effect until the next tick occurs.
Is there a way, without editing source, for me to instantly tick my component with a new interval of 0.0, or set the tick cooldown (its non accessible from my inheriting skelmeshcomp) to 0 so that the tick fires the very next frame?
Actors can have multiple tick functions. You could set up one tick function that runs every frame, and another with 0.5s intervals, and when you enable one, disable the other. Then have both call your own HandleTick function. Two caveats: this requires C++ knowledge, and I have not done this before, so I can only recommend reading the Advanced Ticking Functionality section of the documentation.
If you are in blueprint only, I don’t believe there is a way to do exactly what you want. There may be some workarounds you could try though, such as ticking every frame, but only executing your full functionality if enough time has passed since your last tick; then you would have a variable defining how long to wait between ticks that gets compared against every frame.
My custom skelmeshcomponent is in c++. I don’t have any special logic there in tick there, I am just setting the primary tick to either tick quickly or slowly.
Multiple tick functions seems like a great solution!
Just to confirm, I will have my own two independent tick functions, each with their own speed. The only thing in each function would be a call to the parent class’s tick function. Does that sound like what you are suggesting?
Thank you for taking the time to answer my post!
Yep, that’s basically it. You might also want a function that handles switching between the two tick functions, to ensure that they aren’t ever both enabled/disabled at the same time.
The last two paragraphs of the documentation I linked above should fill you in on how exactly to do this. And if that works for you, you can mark this as answered. Good luck!