Search Unity

Resolved Dedicated Server Build & Animations

Discussion in 'Dedicated Server' started by Ahverice, May 28, 2023.

  1. Ahverice

    Ahverice

    Joined:
    Jan 11, 2017
    Posts:
    7
    Hey I have a rather weird question but I'm trying to find an explanation for some behavior I am seeing.

    When on a Dedicated Server build target I know Unity will update the Animator values and times correctly but is it actually acting out the animation?

    I have a melee combat system that relies on raycasting from points on a weapon during a swing and while the server is compiled as a Standalone build everything is working correctly and the server is sending registered hit events to the clients.
    When compiled as a dedicated server everything still works correctly except It's not getting any hits which leads me to believe the animator isn't actually moving my characters arms which have the weapon equipped to swing.

    I'm not sure if I worded this in a way that isn't confusing but I tried.
     
  2. Ahverice

    Ahverice

    Joined:
    Jan 11, 2017
    Posts:
    7
    I can confirm when running the server under the standard "Windows, Max, Linux" build settings the raycast start positions are updated with the bone positions during the animation.

    When running the server under "Dedicated Server" build settings the raycast start positions are constantly in their initial state.
     
  3. Lukeesta

    Lukeesta

    Joined:
    Jan 7, 2016
    Posts:
    79
    This is likely due to the `Culling Mode` of your Animator. If you have it set as `Cull Update Transforms` instead of Always Animate it will never move the transforms on your dedicated server builds since if you have no camera rendering everything will be culled.
     
    Kobix, DungDajHjep and Ahverice like this.
  4. Ahverice

    Ahverice

    Joined:
    Jan 11, 2017
    Posts:
    7
    It's always the simplest things isn't it haha, I'll check it out. Thanks for your reply!
     
    Kobix likes this.
  5. hawaiian_lasagne

    hawaiian_lasagne

    Joined:
    May 15, 2013
    Posts:
    124
    Hi what did you find out? I'm interested to know this too for the same reasons you mentioned.

    Are animations and bone positions updated in dedicated server builds?
     
  6. TheCaveOfWonders

    TheCaveOfWonders

    Joined:
    Mar 2, 2014
    Posts:
    27
    I'm on Unity 2022.3.7f1 and this is not working, I have the culling mode set to always animate, but the events never trigger on the server. Is this working for anyone else?

    EDIT:
    nvm it works, it was my bad, the animations were set to only trigger if you were a host or client, but not dedicated server.
     
    Last edited: Sep 6, 2023
    Kobix and CodeNinja- like this.