Replicated Actor reference inside replicated Character Component is always NULL on client

Hi,

I’m having a replication issue in UE5 and I’m stuck for two days. This used to work in my older systems but now it doesn’t.

Setup

  • I have a Character.

  • Inside the Character, I have a default Blueprint Actor Component called CraftingComponent.

  • The component has:

    • Component Replicates = true
  • The Character:

    • Replicates = true

Inside the component:

  • I call a RunOnServer event.

  • On the server, I SpawnActor (Building actor).

  • The spawned actor:

    • Replicates = true

    • Clients can see it correctly (so actor replication works).

Immediately after spawning, I:

  • Set a variable inside the component:

    • Type: BP_Master_M (Actor reference)

    • Replication: Replicated

    • Replication Condition: None

The Problem

On the client:

If I get the Character → Get CraftingComponent → check that replicated variable,

It is always NULL / Not Valid.

However:

  • The spawned building actor is visible on the client.

  • So actor replication clearly works.

  • But the replicated reference inside the component does not update.

Additional Info

  • The component is a default component (not dynamically added).

  • Component Replicates is enabled.

  • The variable is set on the server.

  • I also tried:

    • Making it RepNotify (OnRep never fires on client).

    • Calling a Multicast inside the component (client never receives it).

    • Forcing Net Update on the Character.

Still the variable is NULL on client.

Question

Is there any known limitation or special requirement for:

Replicated actor references inside replicated Actor Components (attached to a Character)?

Is there something specific required to make component-level replicated variables sync correctly?

Because:

  • Actor replication works.

  • But component variable replication does not.

Any help would be appreciated.

so just to clarify the variable itself must be Replicated (BP_Master_M) and since thats an actor that Actor must also be replicated.

if you still have issues it may be a Relevance thing (ie only relevant to owner or out of net range) but i doubt thats the issue

1 Like

yes the variable is replicated, actor is replicated too

you’ll have to post a screenshot but to be clear i mean the variable actor must be replicated

also keep in mind you’re only setting the variable on the one pawn. it may be the same issue in your other thread where other players wont have that variable set. if you want it global, spawn and save it on the GameState

this is crafting preview, so everything is control under one pawn. there is no need to inform other pawns

ok well you definitely dont need a MC, just set it to replicated/repnotify if you need callbacks and only on server, so show that code

okay i am just making this in run on server, removed MC. should i make something in notify function? i will test this right away

try show the full code, but you only need notify if you need, well the client to know.

its worth learning this but incidentally if its local client preview only do you need replicated at all?

still client sees the variable empty.

here it is not valid, but i can see the actor in client side too.

and the strange thing is; it was working a couple of months ago like other elements of the game.

its worth breakpointing or at least printing your fail paths (ie cast fail or isvalid)

also you AC MasterBuilding doesnt have the replication dots? and where is all this code? Character?

first function is in a replicated actor component, the gate function is calling from the character. first function is never works with the client. there was some prints on it but i disabled it before i sent the screenshot to you. in server it is valid while spawning it. after that, i am trying o reach the variable because i want to turn it. it says it is invalid

im not in editor right now but im pretty sure AC_MasterBuilding should have the replication dots if its enabled so that may be the issue.

possibility 2 is replication takes time, what calls the Character event? its possible its invalid for one tick and then valid a second later but you’ve missed it

a keyboard input calls the character event, about the component, in settings components replicates is true

can you show me the component layout, its a bit confusing because you said you have a crafting component which is replicated.. and a building component too?

is the spawn function on the building component is it also on the character

what i mention about the crafting component is actually AC_ModularBuilding. it is the name of it. and the spawn function is in component.

Should I maybe focus on figuring out why things that used to work before are not working now?

Some of these systems that stopped working were already ready-made plugins. Everything was supposed to work out of the box.

How can it be just a coincidence that the crafting system, the inventory, and the weapon system all broke at the same time?

well you said it was singleplayer before? so not too unusual. maybe start with something simple to test, just replicate a string and print it