I’m working on game with many objects has scripted behavior. Are all those scripts preloaded(to RAM) everytime even if they are not on level? Can unreal handle around 1000 of such scripts(simultaneously around 30 of scripts are live). If scripts aren’t in RAM all time, is it same for iOS/Android? Same for C++?
Hey Rozenbor, I’ve moved this thread to C++ section since basically it’s C++ question and people who could answer are here
Blueprints compile into a BlueprintGeneratedClass, which is a specialized UClass that handles all the script logic. Native classes are built into the executable code and therefore are automatically loaded at all times. BlueprintGeneratedClasses, on the other hand, are an asset derivative and are not automatically loaded. In fact, if a blueprint is not referenced anywhere in your project, it will not be included at all in the final cooked project.
Since BlueprintGeneratedClasses are asset based, this also means they are loaded like assets. If you have a hard pointer to a blueprint instance or blueprint class in some object, then it will be loaded with that object. If you have an asset pointer (TAssetPtr) to a blueprint instance or class, it will be loaded whenever you call StaticLoadObject or a similar method on it.
Loaded blueprints don’t have much of a cost or memory footprint compared to other assets like textures or sounds. There’s no runtime cost for scripts that are not “live”, i.e.: not being ticked or otherwise used in the game.
I’m not sure about iOS/Android, but it should be the same except you have potentially less memory to work with.
Thanks for answer! It’s awesome if it is so. Weren’t sure about it because iOS as example restricts scripting on runtime