Question. Have you done enough nearly identical tests to be sure the occasional lag you see when an actor spawns is being caused by the spawn itself
and not something else?
Is the lag from the actor spawned by the mutator about the same as it is when you summon the actor into the game as admin without any precaching?
(As you just mentioned, that is the test for this.
It just seems to me that your addition is a bit redundant. The actor in question is destroyed instantly.
Precache of the mesh, and the entire actor for the client, if needed for that actor class, will happen when the pcla actor is spawned.
No need to set all those extra variables at that point. This is a temporary actor. Any other attributes should be set elsewhere, either
for that classes defaults globally, or for a specific actor when it is spawned. In any case setting those does nothing as far as precaching the actor.
The ONLY settings that need changed are the ones I do there to the class default bCollideWorld settings that allow any actor to precache on a map even if
there is no chance of them ever actually spawning during gameplay.
Don't take that the wrong way. I am very sure I tested a few things that were doing some of the same stuff as your addition to the code there, but it
Looked very familiar however. I like to test everything every way I can think of.
If I remember correctly there were a number of very very old mutators, that would have a function in them that was never called.
It would just have code that spawned and destroyed a bunch of hardcoded UnrealI and UnrealShare monster classes, but it was never called.
It was just there to force the precache of the meshes etc.... Which it mostly did, but not always, depending upon the map and the actor class etc....
Keep in mind, that wasn't stuff I wrote, but it was stuff I started learning this sort of thing from and seemed to work mostly.
I believe that old method would help eliminate spawn lag on the server itself, but probably did nothing for clients, so they would still have spawn lag the first
time a specific actor class was spawned in the game. I think that since my current method there is actually in a function that gets called, the precache of the
entire actor should happen on both client and server. Even though the temporary actor only exists for a very short time.
Look at the Precache function there in my Dropper v2.0 for what I am currently using. Same will be in the next SwarmSpawner update. (This week I hope. Minor changes...
I have been testing this a LOT on live servers with quite a bit of stuff spawning. (Yay EXU2!) Spawn lag has not been an issue as far as I can tell.
Good observations and feedback. Feel free to correct me on any of this. (I know you will.