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

Animations do not Sync when using Client Network Transform from Samples #1348

Closed
FSKiller opened this issue Oct 23, 2021 · 47 comments
Closed
Assignees
Labels
priority:high stat:backlog Status - Issue could be considered for a future release. stat:imported Issue is tracked internally at Unity type:bug Bug Report

Comments

@FSKiller
Copy link

Describe the bug
When installing and using the Sample Client Network Transform the Network animator will stop syncing the animator values and the remote Animations from Player B will not play in Player A's screen.

To Reproduce
Steps to reproduce the behavior:

  1. Install Netcode for Gameobjects
  2. Install Sample Client Network Transform
  3. Have an Animator with Animations
  4. In the "Player" add the components: NetworkObject, ClientNetWork Transform and Network Animator
  5. Launch a Client and Host/Server
  6. Watch the Animator Component from the remote object not syncing the Variables nor the Animations.

Actual outcome
Remote Animations do not play in local clients and Vice-Versa.

Expected outcome
The Animations should play in local clients and remote clients and the animatiors should be synced.

Environment (please complete the following information):

  • OS: Windows 10
  • Unity Version: 2021.1.25f1
  • Netcode Version: 1.0.0

Additional info
-This issue was not present in MLAPI 0.1.0

@FSKiller FSKiller added stat:awaiting triage Status - Awaiting triage from the Netcode team. type:bug Bug Report labels Oct 23, 2021
@Tivise
Copy link

Tivise commented Oct 23, 2021

Same issue :( ! (Animator parameters not synced)

@joaoborks
Copy link

joaoborks commented Oct 23, 2021

For me, it is not working even when using the regular NetworkTransform. I'm on 1.0.0-pre.2.

@joaoborks
Copy link

I just found out that using the Boss Room Network Animator works (sort of). It does not actively sync as it was supposed to, but it's a start.

@FSKiller
Copy link
Author

FSKiller commented Oct 23, 2021

Managed to get Anims Working by using RPC's to set Anims params, but this should not be needed.

@aazzolini
Copy link

Seems like it's fixed in master #1327

@FSKiller
Copy link
Author

it's not, i tried both master and devop 1.0.0 pre3 none work

@aazzolini
Copy link

@FSKiller the way I made it work is actually copying the code of NetworkAnimator into my own MyNetworkAnimator and commenting out those "if (valueInt != oldValue)" statements in WriteParameters

@FSKiller
Copy link
Author

As Luke said on Discord their new implementation is Server Authoritive, i managed to get them working too, but i used Rpc's to call the values. This is a pain if you want a Client Authoritive Game....

@will-mearns
Copy link
Contributor

Added to the backlog as MTT-1565

@will-mearns will-mearns added stat:backlog Status - Issue could be considered for a future release. and removed stat:awaiting triage Status - Awaiting triage from the Netcode team. labels Oct 29, 2021
@will-mearns will-mearns removed their assignment Oct 29, 2021
@daalen
Copy link

daalen commented Nov 2, 2021

I have the same issue. @aazzolini's solution of making a new NetworkAnimator with the if statements commented out caused some animations to be synched, but only certain transitions (for example into running, but not back into standing still). It's only one way too: the client gets to see some of the animations of the host, but the host sees none of the client.

@LaserYGD
Copy link

LaserYGD commented Nov 2, 2021

As Luke said on Discord their new implementation is Server Authoritive, i managed to get them working too, but i used Rpc's to call the values. This is a pain if you want a Client Authoritive Game....

Many indie projects are better off client authoritative. Less headaches in general, cheating isn't really a consideration, all that matters is to finish the game and get players.

Hopefully they support more client auth stuff, not just server or do it yourself.

@Shivang44
Copy link

Shivang44 commented Dec 26, 2021

As Luke said on Discord their new implementation is Server Authoritive, i managed to get them working too, but i used Rpc's to call the values. This is a pain if you want a Client Authoritive Game....

@will-mearns if this is the case can we please update the documentation (https://docs-multiplayer.unity3d.com/docs/components/networkanimator) that it won't work with clients setting params on the animator? It seems to imply that all you need to do is add a NetworkAnimator and you're good to go. Spent quite a few hours debugging the NetworkAnimator script only to find that it may actually be a bug?

Let me know if I misunderstood this. Thanks!

@MiTschMR
Copy link

Any news on this, maybe an approximate date? It is basically useless if you use an asset that does all the animations if they can't be synced.

@LaserYGD
Copy link

LaserYGD commented Jan 19, 2022 via email

@MiTschMR
Copy link

MiTschMR commented Feb 1, 2022

What I found out using 1.0 pre-5 is that if the Player you are controlling is instantiated on a Host, the animation sync happens if the NetworkAnimator component has the checkboxes checked. However, if you are a simple client, it doesn't happen because it is server authoritative. How would you guys do it if an asset you own has a player component that handles all the input via its own code and can't be changed without major refactoring? In my opinion there should be a checkbox or something similar to let the clients control the movement if checked. This way you can cover both easily with a single click and focus on the interactive part of the game (which is easily possible to control via the server).

@MiTschMR
Copy link

The network animator has been reworked with 1.0 pre-6 and now looks differently in the inspector, it does not show checkboxes anymore. Is there internal work being done or what was the reason for it?

@Ator9
Copy link

Ator9 commented Apr 30, 2022

Ok, i just found out about this.
I'm currently using the ClientNetworkTransform and i was trying to make the Animator work without luck.

Hoping this can get updated.

@jeffreyrainy
Copy link
Contributor

#1946

Should fix this. Can you confirm ?

@FSKiller
Copy link
Author

FSKiller commented Jun 1, 2022

Still not fixed. Players stay in idle animation and slide across the map.

As a temp fix i've been using RPC's to set the animator values, and this seems to work just fine at the cost of more network traffic.

@ashwinimurt ashwinimurt added the stat:imported Issue is tracked internally at Unity label Aug 1, 2022
@DevinWatson
Copy link

Create this script and then remove the NetworkAnimator and add ClientNetworkAnimator

     public class ClientNetworkAnimator : NetworkAnimator
     {
         protected override bool OnIsServerAuthoritative() => false;
     }

@ChadGatling
Copy link

@DevinWatson This isn't working for me. It enables the animations on the server but not on other clients.

@NoelStephensUnity
Copy link
Collaborator

NoelStephensUnity commented Sep 30, 2022

@ChadGatling
I did apply some fixes just recently to NetworkAnimator that are now in the develop branch that were not synchronizing if there were 2 clients so you might try your project with the develop branch and see if the fixes I applied resolve your issue. These fixes will be included in the next update.

If what is currently in the develop branch does not solve your issue, could you provide a project so I can try to replicate it on my end?

@NoelStephensUnity NoelStephensUnity self-assigned this Sep 30, 2022
@ChadGatling
Copy link

@NoelStephensUnity
I am trying to verify this but I am getting a bunch of unrelated errors after updating to 1.1.0 and even just 1.0.2

@NoelStephensUnity
Copy link
Collaborator

@ChadGatling could you share the errors that you are getting?
I might be able to assist you with those.

@ChadGatling
Copy link

ChadGatling commented Oct 6, 2022

@NoelStephensUnity

Here is the first error I get with 1.1.0 as a client trying to connect to my server.

image removed

The server is seeing the client connect but then I get a handshake timeout. Then the server disconnects the client.

image removed

Thanks for looking.

@NoelStephensUnity
Copy link
Collaborator

NoelStephensUnity commented Oct 6, 2022

@ChadGatling
What version of Unity are you using? There was a recent update to make NetworkVariables handle managed types and this requires the most recent version of Unity (or higher) to use the current develop branch:
2021.3.11f1 LTS
2020.3.40f1 LTS
2022.1.19f1

As well, if you want to use a specific branch you can update your Packages\manifest.json file with something like this for com.unity.netcode.gameobjects:

    "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop",
    "com.unity.transport": "1.3.0",

(I included the most recent version of unity transport in there too)

This can be useful if you want to make sure you have the most recent version of a specific branch without having to download and point to the specific directory etc.

If you were using an earlier version of Unity, let me know if updating to the more recent version resolves these error messages for you?

@ChadGatling
Copy link

ChadGatling commented Oct 6, 2022

@NoelStephensUnity
I updated my editor to 2021.3.11f1 and I am still getting the same issues

@ChadGatling
Copy link

ChadGatling commented Oct 7, 2022

@NoelStephensUnity The previous still applies and I also tried it with Netcode for GameObjects 1.0.2 and on the server on player connect I am getting

image

and on the client right after connecting I get

image

The client actually connects but the network transform is not working. The animator works but the character remains in place. I am using client network transform and animator.

Edit: Seems like 2021.3 requires Shader graph 12.1.7 which breaks all my shader graph shaders so something is really messed up.

@NoelStephensUnity
Copy link
Collaborator

NoelStephensUnity commented Oct 7, 2022

@ChadGatling
Ahh...well at least the errors you are getting are different than before and so updating did help resolves those errors.
It looks like you are still using the 1.0.0-pre.3 version of ClientNetworkTransform.
Replace that with the updated version of ClientNetworkTransform.
That should resolve the new errors you are getting.

@ChadGatling
Copy link

ChadGatling commented Oct 7, 2022

@NoelStephensUnity So this version of ClientNetworkTransform is for the 1.0.2 version of Netcode for gameobjects? Or for 1.1.0? And all of this is to be used with Unity 2021.3.11? I can't seem to find the info about what version requires what version

@NoelStephensUnity
Copy link
Collaborator

NoelStephensUnity commented Oct 7, 2022

@ChadGatling
Apologies for the confusion we are close to releasing the next version which has many updates.

The updated version of ClientNetworkTransform should be for v1.0.2 and beyond (which includes anything in the develop branch)
The next version is going to be v1.1.0 which is what is currently in the develop branch.

If you still have the suggested updates applied to your project's manifest file:

    "com.unity.netcode.gameobjects": "https://github.com/Unity-Technologies/com.unity.netcode.gameobjects.git?path=com.unity.netcode.gameobjects#develop",
    "com.unity.transport": "1.3.0",

And you are using the updated version of ClientNetworkTransform.

And your are running 2021.3.11f1 LTS.

Then the errors you have posted in this thread should not be occurring.

Are you getting errors that are different than the ones you you have posted so far?

@ChadGatling
Copy link

Yes I am running those versions and I am getting this error when the client tries to connect. And the handshake timed out message on the server side.

image

@ChadGatling
Copy link

@NoelStephensUnity The issue seems to stem from this

image
image

MessagingSystem.RegisterMessageType is not run if that helps

@ChadGatling
Copy link

@NoelStephensUnity I went through one by one updating stuff and everything worked until I updated to Netcode develop. That is when I got the KeyNotFoundException: The given key 'Unity.Netcode.ConnectionRequestMessage' was not present in the dictionary. error.

@NoelStephensUnity
Copy link
Collaborator

@ChadGatling
Could you share your manifest file and what platform are you compiling for?

Also, could you exit the editor, delete the Library/ScriptAssemblies folder, then re-open the editor and once it is done loading your project share the editor.log file generated? (we have a few people looking into this issue and this information will help us track down this issue).

@ChadGatling
Copy link

@NoelStephensUnity

I am running on Windows 10.
No active NetworkLists in project

Editor.log
manifest.json

@ShadauxCat
Copy link
Collaborator

@ChadGatling Can you do the same thing again, but delete the entire Library directory this time instead of just ScriptAssemblies, and then upload Editor.log again?

@NoelStephensUnity
Copy link
Collaborator

@ChadGatling
Heh... sorry for the barrage.. but we are hunting down this issue that this seems to be happening for a couple of users.
If you don't mind... could we also get a copy of your ProjectSettings\ProjectSettings.asset file?
It seems like ILPostProcessor is not being ran for your project and we are trying to determine why.

@ChadGatling
Copy link

ChadGatling commented Oct 11, 2022

@ShadauxCat @NoelStephensUnity I got you
Editor.log
ProjectSettings.asset
Its all good. You are doing me a favor really. Also, I was barraging you a bit over the weekend.

@ShadauxCat
Copy link
Collaborator

@ChadGatling That time, it looks like ILPostProcessor did run... can you try your test again and see if you still see the KeyNotFoundException? If you do, could you upload Libraries/ScriptAssemblies/Unity.Netcode.Runtime.dll?

@ChadGatling
Copy link

ChadGatling commented Oct 11, 2022

Oh I am not on Netcode 1.1.0 I am on 1.0.2. Sorry yall, I should have realized that is what you needed. Do you want me to get back on develop?

Also there might be a better way to communicate than on this thread.

@ShadauxCat
Copy link
Collaborator

ShadauxCat commented Oct 11, 2022

Ah, yes, can you please repeat the last step on develop (deleting the whole Library directory) and then upload Editor.log again?

@ChadGatling
Copy link

Comin' in hot
Editor.log

@ShadauxCat
Copy link
Collaborator

ShadauxCat commented Oct 11, 2022

Ok, I do see ILPostProcessor running... this would be so much easier if I could reproduce this.

Would you be up to helping out with some debugging in a custom branch tomorrow? (Are you in the Netcode for GameObjects discord? If so, you can find me there as Kitty [Unity] and send me a DM and we can do this more quickly.)

@NoelStephensUnity
Copy link
Collaborator

@ChadGatling
Just checking in and seeing if you are able to use NetworkAnimator with v1.1.0 now that it is released?

@ChadGatling
Copy link

@NoelStephensUnity I did test it with @ShadauxCat 's experimental branch for the .NET framework issue. It was working and I could get 2 players syncing animations while on a dedicated server. I think I did test the develop branch again once she pulled her branch to it and it worked. I haven't yet tested it released.

Weirdly it does not give me the option to update to 1.1.0 in the package manager. I can change the version manually in the Manifest but then it tells me to update to 1.0.2. Weird

before
image
image

after
image
image

@jeffreyrainy jeffreyrainy removed their assignment Oct 27, 2022
@NoelStephensUnity
Copy link
Collaborator

Yeah, that is a known "thing"... there is a transition over to how package manager handles this.
If you delete Netcode for GameObjects via the package manager and then add it back via the package manager it will show v1.1.0.

I am going to close this issue since the primary issue appears to be resolved.
If you run into issues with the package manager stuff feel free to post here again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority:high stat:backlog Status - Issue could be considered for a future release. stat:imported Issue is tracked internally at Unity type:bug Bug Report
Projects
None yet
Development

No branches or pull requests