FishNet icon indicating copy to clipboard operation
FishNet copied to clipboard

Prediction V2: Server-side input not working

Open ryangarber opened this issue 3 years ago • 2 comments

When calling Replicate(IReplicateData) on the server, the data disappears. Replicate() only ever receives ReplicateState.Predicted and default data.

More information, a video example, and the project itself are in this repo: https://github.com/RyanGarber/FishNet-PV2/tree/main#server-input-bug

ryangarber avatar Sep 12 '23 17:09 ryangarber

I made a quick change that is working in initial tests. If you would like to try it out further I'd be very appreciative... open NetworkBehaviour.Prediction and modify the first few parts of this method as shown...

New

        protected internal void Replicate_Owner<T>(ReplicateUserLogicDelegate<T> del, uint methodHash, List<T> replicatesHistory, T data, Channel channel) where T : IReplicateData
        {
            bool ownerlessAndServer = (!Owner.IsValid && IsServer);
            if (!IsOwner && !ownerlessAndServer)
                return;

Before

        protected internal void Replicate_Owner<T>(ReplicateUserLogicDelegate<T> del, uint methodHash, List<T> replicatesHistory, T data, Channel channel) where T : IReplicateData
        {
            if (!IsOwner)
                return;

FirstGearGames avatar Sep 14 '23 13:09 FirstGearGames

Sorry for the late response; I was unable to test this until now. It appears to have fixed the issue in both the test project and in my production project. Thanks!

ryangarber avatar Sep 19 '23 04:09 ryangarber