I have two questions about the difference between Camera Shake Base and Legacy Camera Shake, and about using Async Load Asset Class with Start Camera Shake inside my Character Blueprint.
Is there any known performance or resource difference between Camera Shake Base and Legacy Camera Shake, or are they functionally equivalent in most cases?
When I use Async Load Asset Class to load my camera shake, the reference of the shake remains attached to the Start Camera Shake after execution, preventing the GC from cleaning it. Is there any proper way to release this reference, or is the retained reference negligible in terms of memory optimization?
Thank you very much for your time and patience.
Regards.
let’s start with the basics Camera Shake Base is the modern and recommended system in UE5, offering greater flexibility and control through Blueprints and curves.
Legacy Camera Shake is the old system ,from UE4, kept for compatibility.
To test how each one works and compare their performance, you can do the following:
Create a BP_LegacyCameraShake and a BP_CameraShakeBase, both with equivalent values.
This displays CPU time per frame.
In general, the values should be identical or show only minimal differences , at least that’s what I found in my tests. So you can safely say there’s no real performance difference.
So I recommend using Camera Shake Base, since it’s the modern base class in Unreal Engine 5, designed to be more flexible and powerful than the Legacy system.
I’ll also leave you the documentation in case you’re interested.
I don’t know much about the topic, but you could try the following to see if it gets cleaned up by the GC. Create a variable to store the return value from Start Legacy Camera Shake, then use Stop Camera Shake to manually stop it. But i don’t think there are any major memory optimization issues.
(I used keys 1, 2, and 3 just for testing, but I recommend trying it properly with your own setup.)
Also, if you want to test it more thoroughly, you can use Unreal Insights which is a telemetry capture and analysis suite that can capture events from your project at high data rates. Unreal Insights helps you identify areas of data that might require optimization.
If you have any questions, don’t hesitate to ask again on the forum!
Hope it helps!
First of all, thank you very much for taking the time to provide such detailed explanations and screenshots. I really appreciate it.
Camera Shake Base vs Legacy Camera Shake:
Understood. I’ll switch to Camera Shake Base to stay up-to-date. By the way, I ran a test with infinite shake and noticed a small difference between Legacy and Base. As you mentioned, Camera Shake Base is slightly faster than Legacy. CPU time per frame was around 0.09ms for Legacy and 0.08ms for Base.
Garbage Collection and Start Camera Shake:
I don’t think the issue comes from using Stop Camera, Stop All Camera Shake or Stop All instances of Camera Shake, since my Shake is not looping. I tried several methods to stop the shake and clean the reference, with and without variables, but I haven’t found a proper solution yet.
Currently, I call my Shake Soft Class Reference using Async Load Class, Cast to Camera Shake class, and plug it into Start Camera Shake without storing it in a variable. I expected the GC to handle it automatically because I used a Soft Class Reference, but it doesn’t.
I don’t encounter this issue with Soft Object References; GC works perfectly in that case. Perhaps this is just how Soft Class References behave. I really don’t know. I’m not sure yet, so I’m trying to understand whether this is expected behavior.