Another workaround would be to Set Collision Profile Name
Since we now know this is intended behaviour of component, most simple workaround would be to create a OnRep function.
This is my setup for now:
MyClass.h
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Building)
class UBoxComponent *CollisionVolume;
UPROPERTY(ReplicatedUsing = OnRep_Collision)
bool collision;
UFUNCTION()
void OnRep_Collision();
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
MyClass.cpp
AMyClass::AMyClass(){
bReplicates = true;
CollisionVolume = CreateDefaultSubobject<UBoxComponent>(TEXT("CollisionVolume1"));
CollisionVolume->SetupAttachment(RootComponent);
CollisionVolume->SetCollisionProfileName(UCollisionProfile::NoCollision_ProfileName);
CollisionVolume->SetIsReplicated(true);
collision = false;
}
void AMyClass::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
DOREPLIFETIME(ABuildable,collision);
}
//called on server from client outside class - look up server RPC
void AMyClass::Place(){
CollisionVolume->SetCollisionProfileName(UCollisionProfile::BlockAll_ProfileName);
collision = true;
}
void AMyClass::OnRep_Collision() {
if (collision) {
CollisionVolume->SetCollisionProfileName(UCollisionProfile::BlockAll_ProfileName);
}
}
Of course if you have any sort of effects associated with this, you would execute them on a multicast. Creating a Enum type for collision also works, but for my personal use I do not need it.
For those who want to check out a further explanation of why this works, check out example map or tutorial from Reuben Ward at Learn Unreal Engine Networking in 30 Minutes - YouTube .