Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Networked Prefab has trouble referencing child prefab components through RPCs #7392

Open
dotryen opened this issue Jan 16, 2025 · 2 comments

Comments

@dotryen
Copy link

dotryen commented Jan 16, 2025

Describe the bug

I have a weapon prefab and an ability object that needs to reference the weapon's model. This reference is setup when the player is started but fails to use said reference when an RPC is called. This is called for every instance on every client, and using [Property] I can see that the components are properly set up.

Code:

private SkinnedModelRenderer model;

// Called for each player instance on every client. Owner or not.
public override void Setup() {
    base.Setup();
    model = Player.Combat.Weapon.Model;
}

// This function warns that model is unknown despite model is NOT null.
[Rpc.Broadcast]
private void DoAnim() {
    if (!model.IsValid()) return;
    model.Set("Parry", true);
}

Log:

OnObjectMessage: Unknown Component [76de8246-5cf7-4ee6-b39b-92587a09bb5a](arg:0) on examplesword for RPC DoAnim

To Reproduce

  1. Have a networked prefab reference a child prefab component on every client.
  2. Try to access it via RPC.

Expected behavior

I should be able to reference the component that I set a reference to earlier.

Media/Files

No response

Additional context

No response

@github-project-automation github-project-automation bot moved this to To triage in s&box tracker Jan 16, 2025
@dotryen dotryen changed the title Networked Prefab has trouble referencing child prefab objects through RPCs Networked Prefab has trouble referencing child prefab components through RPCs Jan 16, 2025
@kurozael
Copy link

kurozael commented Jan 17, 2025

This would indicate to me that the object the component is on is not actually a networked object. This looks like the kind of RPC error you get when an object isn't networked - are you sure the game object is set to Networked Object in the inspector?

@MrBrax
Copy link

MrBrax commented Jan 17, 2025

accessing networked children from a networked parent has never been straightforward, if this is the same issue i'm thinking about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To triage
Development

No branches or pull requests

3 participants