mmm. I need to check if we added some changes/fixes in the GhostUpdateSystem in regards buffer (but I don’t remember right now). Accessing that out of bound like that looks like we deserialised something incorrectly. Can I ask more info about the prefab setup? Is that buffer on a child entity?
@CMarastoni Actually I think u should improve Netcode to make it to log clear error message when GhostUpdateSystem goes wrong. With the current error message I have no way to track the source of error. I only can keep guessing and trying until I fix the error.
@CMarastoni Also getting this error. Seems like linkedEntityGroupAccessor returns a wrong
linkedEntityGroup, from a totally different ghost entity. This doesn’t happen immediately but after a few seconds of playing, so maybe something gets invalidated/shifted around.
edit: For me this happens when a 1st level child of a ghost prefab has a component variant with
SendDataForChildEntity = true. When I stop using that variant the error no longer happens. But this is an important feature for me so…
Could you please give more details about it?
Sounds like a bug we fixed internally some time ago, but I need more information to understand were it happen.
Need a little more info to understand what going on.
Hierarchy, component/buffer types that are serialized, type of variant assigned.
If you have a repro in some project I can take also a look
@CMarastoni Player’s prefab has Default Ghost Mode set to Predicted. It’s a physics body (but I disabled physics on clients). That prefab has a child, whose rotation I need to be sent to clients, so I have a variant for rotation:
The player prefab also has a Health and Inventory components defined as [GhostComponent(PrefabType = GhostPrefabType.AllPredicted, OwnerSendType = SendToOwnerType.SendToOwner)]
I found just now that removing those 2 components from the prefab makes the error disappear (I think), do those attribute settings conflict with each other?
I suspect he has something to do with the SendToOwner setting. We fixed a bug there not long time ago that was causing the entities being deserialised incorrectly.
Just to verify that, could you please try to change the SendToOwner to its default?
Nope, still same error without SendToOwner.
edit: Narrowed it down to the Inventory GhostComponent. Just adding it to prefab causes the error, even though I commented out all the usages of that component in my systems. The component is the simplest component possible:
[Serializable]
[GenerateAuthoringComponent]
[GhostComponent(PrefabType = GhostPrefabType.All)]
public struct PlayerInventoryComponent : IComponentData
{
[GhostField]
public int Ammo;
}
The problem is not the component itself, it is something in relation to child entities (and probably buffers to some extents). There were some issues in that sense (I also posted some fix in the forum).
Could you give me the full set of components (variants included) that the prefab has?
Not sure how to share it, as the list is huge. That’s half of it, nothing interesting further down, it goes up to 27 children (yes I know it’s a lot). Only a few of those are actually sent, adds up to around 11 bytes in snapshot. The only variant I have on that prefab is that child’s rotation. No buffers other than single command buffer.
If you mean the diff of GhostReceiveSystem you posted, it doesn’t help.
edit: Is there a way to work around it? Since we can’t expect a new version release any time soon. I need a turret to be a child of a boat to inherit position and base rotation, but I can’t send child’s rotation to actually rotate the turret.
edit2: I found a nasty workaround if anyone needs it. Instead of actually sending children’s component, I added a “proxy” ghost component to the parent that stores child’s data. Since that proxy is on the parent, it works ok. Then, on both server and clients, I copy the data from proxy component to actual rotation of the child. No errors in editor, standalone still crashes instantly tho, I think NRE at GhostUpdateSystem.cs:247
It wasn’t very buggy but in general NetCode had some bugs here and there (some from the past too) that we fixed. I saw already something similar but it was due to a mix of other things. Here you are using a variant for translation on a the child entity. Worth to check it out. I will to setup something similar.