Component: SetIsReplicated(true) -- All variables also replicated?

I have a component derived from UStaticMeshComponent and in the constructor I have *SetIsReplicated(true). *Should this mean that if I have a variable *int MyInt; *declared in the .h that that integer will also be replicated?

I’m having some issues that suggest it’s not…

No. SetIsReplicated(true) just says that a Component can be replicated. You still need to mark individual fields as Replicated and add them to the LifetimeProperties array.

// Header

// Method override so we can tell the system about our property.
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const;

// Mark this field as replicated.
int MyInt;

// Source
virtual void MyClass::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const

     DOREPLIFETIME(MyClass, MyInt);

More here: A new, community-hosted Unreal Engine Wiki - Announcements and Releases - Unreal Engine Forums

Thanks very much, Matt. That makes sense :slight_smile: