Spawning an BP which has an Enum in construction script will cause client to lost connection

First of all, this is a very specific case and I now a few workarounds but didnt test them yet. Its complicated to even explain but I will try my best. There is a link to clean project with comments in BPs at the end you can look at that directly too.

Problem: Spawning an actor which has a Mobility Enum inside its construction script will cause client to lost connection.

  • It wont lost connection if Swicth on Enum doesnt have input and set to moveable. But it will give errors.
  • It wont lost connection if Add Static Mesh Component’s replicate component is false. This way, BP will spawn on everyone but Set Static Mesh wont replicate and only Server will see mesh.

This only happens with specific settings. And I want to work with those settings :). I set Default map to an empty level to better see connection lost. Open ThirdPersonExampleMap and Preview it with 2 players. Left click will spawn the normal way. Right click will spawn with Enum

Edit: Lol I forgot to give the link.
https://drive.google.com/open?id=0B-lb1P0opFRyQ1BxNmlUWmNqSnM

I found a perfect workaround for it. Dont know why it works.

  • Select everything in Construction Sript and collapse them to funtion. Name it Construction Function
  • Make a bool variable. Name it SpawnedRuntime?. Expose it on Spawn
  • Make this bool false on default but true on spawn
  • Put a Branch on Construction Script with SpawnedRuntime? in input. Hook Construction Function to false
  • Put a Branch on Begin Play with SpawnedRuntime? in input.Hook Construction Function to true.

Works like a charm. I still wonder why it doesnt work in the first place

217659-1.jpg

217660-2.jpg