Pawn destroys itself after RTS-style camera moves too far away.
I'm working on an RTS game kind of like Warcraft 3, where each player has a hero unit along with their regular units. While testing the UI, we discovered an issue in that, when the camera moves far enough away from the hero, the clientside version of that hero is destroyed. Upon returning the camera to the hero's location, a new one is spawned with a different name.
Our debugging took the level blueprint, ran an event tick that got all actors of the hero's class, and printed their display names. Client 1 currently owns AI_KIMHero1.
After moving the camera away, the hero's model disappears and Client 1 no longer prints a display name. Presumably, UE4 is temporarily culling the pawn to improve performance.
Moving the camera back towards the pawn's position prior to it destroying itself, a new pawn called AI_KIMHero2 is now owned by Client 1.
Does anyone know what is causing this, and if it can be disabled, or a workaround? We know that the dedicated server's copy is not destroyed, but we're stuck on how we could use that to fix our issue.
asked Jan 12 '16 at 06:15 PM in Everything Else
You probably need to increase the 'Net Cull Distance Square' value in the Replication category of your Actor's settings. It defaults to 225000000.0, which is 1.5km, depending on your world scale settings (sqrt of 225000000.0 is 15000.0).
(The value is specified as 'distance squared' instead of simply distance because it's computationally less expensive to use this number to calculate distance while the game is running.)
If your project is a C++ project, it's also possible to override this in other ways that avoids having to type in a ridiculously huge number, but I'm not sure about Blueprint.
answered Jan 13 '16 at 12:24 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here