I’m running Unreal Engine 4.16.1 and I’m experiencing a crash on server-side immediately after a client successfully connects. The crash is happening in engine code, the top of the stack trace looks like this:
It’s probably crashing because it doesn’t have an InputComponent at that point and you weren’t checking for a nullptr. All input should be setup in SetupPlayerInputComponent. Clients run things in different orders to the server a lot of the time and you can never guarantee that code that runs on a server will also run reliably on a client.
Also from a design standpoint, I wouldn’t recommend storing an actor iterator to calculate bounds for a camera, but instead create a custom volume that a level designer places in the world and get the min/max bounds from that, or even setting it in World Settings. Since the world size probably never changes, it’s safer and cheaper.
Also, you’re storing an old version of the actor iterator as soon as you spawn a new actor.
Thanks for the answer Yes, I got up a night, suddenly having an idea what could be causing trouble here, remembering the good old Unreal 3 times. My own answer just had to be approved by a moderator first.
Actually, the camera bounds actor is placed by the level designer. I felt a little helpless accessing that one in code, is there any safer and cheaper way of doing that in C++?