AttachRootComponentTo Replication Bug

Hello,

Apparently, there is an issue in AttachRootComponentTo(), that it does not replicate actors correctly to clients.

More details of this bug can be seen on this forum topic. Also, I found out that there’s a Hack in UT source code to allow this replication (I don’t understand it very well, thought I haven’t inspected it deeply).

I tried testing my source code on UE4.8P4, but I hit this conversion bug.
Since I couldn’t find an UT-XXXXX bug report, I’m reporting this here. Hopefully ir’s not a duplicate of another bug already reported.

I’d like to assist in this bug, to help reproducing it, etc. It’s something I really would love to see fixed :slight_smile:

Thank you in advance!

Hi Zoc,

As far as I know, there isn’t any problem with replication after using AttachRootComponentTo(). Can you describe exactly what’s happening, and how you’re trying to use it? Where are you calling AttachRootComponentTo() from, and are all Actors involved set to Replicate and Replicate Movement?

Are you able to reproduce this in a new project? If so, would you mind uploading that test project somewhere and getting us download link? Which version of engine are you using? You mention UT… is this a UT Editor bug, or are you using UE4 source?

Hello ,

This is source code I’m using. only check in there that’s not compatible with default UE4 code is team check, which can easily be removed and has no impact in this issue.

This is what I’m doing and what’s happening:

    1. Use that code and add a blueprint
    1. Change Blueprint FlagMesh
      component to an actual Mesh
    1. Drag
      and drop blueprint into level
      ( previous numbers are trivial,
      but I decided to describe them
      anyway)
    1. Start game in
      “Play-In-Editor” mode with number of
      players = 2 (I tried with 3 too)
  • 5a) If I move “listen server” player
    (editor one) through flag, it
    gets and attach flag (I can see
    it’s shadow easily). client
    doesn’t see any change.
  • 5b) If I move
    client through flag, flag
    doesn’t disappear from ground,
    BUT “listen server” (editor) see
    client player carrying flag
    (attached to him) and flag
    disappears from ground.

I’ve tried calling AttachRootComponentTo() from a bunch of places. Right now, it gets called inside a RPC + NetMulticast call, started with OnOverlapBegin() method.

This is an UE4.7 bug. I decided to take a look on UT source code (since it has a CTF mode) to see how it works and I stumbled across this piece of code, inside UTCarriedObject.h, where it describes there’s an actual bug in engine code.

	// workaround for bug in AActor implementation
	virtual void OnRep_AttachmentReplication() override;
	// HACK: workaround for engine bug with transform replication when attaching/detaching things
	virtual void OnRep_ReplicatedMovement() override;

I’ll add this flag to a new project, minus team check, and post it here.

I’m sorry !

Apparently this was a problem on my side. For some reason, my Blueprint replication value was disabled even when I explicitly enabled it in constructor.

My apologies :frowning:


Edit: I think I should clarify on this:

I created a new project and it worked.

Then I started stripping my project to find out what was wrong.
When I moved an asset from one project to another, it failed.

Using a diff tool I could pinpoint that problem was on blueprint.
I’m really really sorry for this… Can’t believe it took this long to find it. :frowning:

No problem, I’m glad you found solution! I’ll go ahead and resolve this post, then.