component with NeedsLoadForServer that returns false is still having its native constructor called, and it seems like still constructed on server. Why?

Hi Epic Friends!

I have a subclass of USkeletalMeshComponent that I’ve overridden NeedsLoadForServer on to be false. I have an instance of this component in my character blueprint. (in fact, it’s the CharacterMesh0- created in the constructor of ACharacter as a default subobject- maybe relevant) I thought this was all working because I stopped seeing unreal insights reporting time every frame to update this mesh component on the server. however, I recently hit some other errors that suggested to be the mesh was being created on the server when the character was instanced, so I put an ensure in the native constructor and it is being hit quite a lot! it seems like every time I spawn the actor! Is this expected? And if so, what is the correct way to make sure a component absolutely does not spawn on a server?

Thanks!

Josh

Hi,

This is a known issue with components, and I unfortunately can’t provide any estimate as to when this may get resolved: Unreal Engine Issues and Bug Tracker (UE\-193927)

In the meanwhile, you may need to implement some extra checking around this component’s initialization to prevent it from doing unnecessary work on the server. For instance, you could check if the instance is a dedicated server before registering the components, destroying any default subobjects that the server doesn’t need. Another option could be to have the component itself check, such as how the UTextRenderComponent checks IsRunningDedicatedServer() before initializing anything.

Thanks,

Alex

Thanks, Alex! Ok, good to know! We will look into work arounds.

Best!

Josh