How do I avoid lag when effect spawns?

Dear all,

I am creating a game with a lot of different spells. Each spell is represented by an actor that I spawn in blueprint. Some spells have special effects, that involve either loading relativelly big textures. Whenever the spell gets spawned, I get a noticable lag. I suspect it is due to texture streaming, as it only appear when the actor of specific type is spawned for the first time.

Is there any way to force preloading all the textures of a specific actor type ahead of time, or any other way to avoid this lag? Ideally, I would like to force those textures when the game gets loaded. It is not a problem if the solution is in C++, I would just like to know how as this seems like a very trivial task, maybe I am missing something.

Best regards,

I have the same issue on mobile devices. Whenever I spawn a class currently not already in the scene, I get a little jerk in performance for a split moment. I worked around this simply by actually placing the class in the level in an area that the player cannot access or see. I know it is not the best solution… But until I figure out how to pre-load an object into memory, it will have to do.

Yeah, I tried that as well, but I have many different levels plus there are around 50 different effects so I don’t want to place them into the level each time. I guess I could make a “caching actor” that spawns all effects in hidden mode but that seems like too much work, and it is very error prone and not extendable. Some effects actually spawn particle systems dynamically so this would also not work out of the box …
Thanks for the solution anyway, it works:)

Yes, but how do I load textures so they are streamed in, preferably through blueprints? Ideally, I would like that all things later referenced by spells are loaded in advance. And I need to load all spells since it is a multiplayer game, and more or less all spell get used.
Currently, we have external program to do all the (networked) configuration e.g. main menu. My question is, more or less, how do I load and keep some specific textures in memory. I can load them at game startup but i would prefer not spawning actors to achieve this (if I read the documentation correctly, this only garanties the textures to stay there until they are streamed out when the video memory is low).

Does your character have a hotbar or some other place where things are assigned to keys? Load your textures when the player chooses which spells they are going to use so that lag happens in a menu where it won’t be noticed.

Yeah I was going to say just spawn them under the world, but multiplayer does make that moot.

I don’t think blueprint gives you any option to specify things like what texture gets loaded and when other than actually spawning them in the world.

Probably something you can do in C++ but not my area of expertise. :slight_smile:

I have been using “spawn under the world” for a long time now and it seems to be the way to go. Also, I only put effects that require big textures there. It also works for multiplayer. Basically, I have an actor where I add all the particle system components that require long load times and set the effects in there, then I place it in each level in a hidden place. It will load on clients and servers.