-
Notifications
You must be signed in to change notification settings - Fork 450
feat: network animator Trigger parameter support #872
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
Conversation
… than before, supports Triggers but currently does not rely on netvars
…nity.multiplayer.mlapi into feature/networkanimator-trigger-overrides-support
…nity.multiplayer.mlapi into feature/network-animator-triggers
…eird - we can't wait on serializing data till the tick end, this way we will most likely loose some of the netvar values which is potentially bad for trigger-based animations
…nity.multiplayer.mlapi into feature/network-animator-triggers
…ty that's driven by animator curves There is no reason to sync these parameter values - they are being indirectly updated via the layer state sync.
just an early heads-up, I was planning to remove Unity-Chan! entirely from the testproject. medium/big assets make Yamato spend more time in tests due to importing and I think both for testing and the sake of package being smaller, we need to use primitives and small assets when it's absolutely required (I know, I put that in and made that mistake in the first place but will correct my mistake). |
@MFatihMAR Aye-aye. I will replace UnityChan usage with something more lightweight after we're done with the draft review stage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the improvements to NetworkAnimator are great and we should merge them for now to improve the animator which already exists and solve some of our user needs.
I don't think we are there yet with the NetworkAnimatorVar
. I'm not convinced about including parameters in the animator state and the overall approach in general. I think this part needs some more exploration and potentially a bigger effort for creating a next generation network animator.
…nity.multiplayer.mlapi into feature/network-animator-triggers
…nd replaced it with a nice spinning cube.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! NetworkAnimator looks much more clean now than before.
{ | ||
[CustomEditor(typeof(NetworkAnimator), true)] | ||
[CanEditMultipleObjects] | ||
public class NetworkAnimatorEditor : Editor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there anything replacing this or do you think default inspector UI (Editor) is good enough now?
{ | ||
if (IsOwner) | ||
{ | ||
if(Input.GetKeyDown(KeyCode.C)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might consider running ./standards.py --fix
once to format all source files :)
if(Input.GetKeyDown(KeyCode.C)) | |
if (Input.GetKeyDown(KeyCode.C)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks like a good refactor to me!
I left some minor comments & questions here and there.
one more thing though, would you also remove Unity-Chan! stuff in this PR as it was mainly there for testing/showing NetworkAnimator working but now we have simple cube anims replacing it?
…ity-Technologies/com.unity.multiplayer.mlapi into test/multiprocess-tests/orchestration * 'test/multiprocess-tests/orchestration' of github.com:Unity-Technologies/com.unity.multiplayer.mlapi: Update testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs rename test scene changing root menu no longer ignore '[Ss]treamingAssets/buildInfo.txt' feat: network animator Trigger parameter support (#872) # Conflicts: # testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs
…rocess-tests/base-multiprocess-tests * test/multiprocess-tests/orchestration: Update testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs rename test scene # changing root menu PR suggestions no longer ignore '[Ss]treamingAssets/buildInfo.txt' feat: network animator Trigger parameter support (#872) # Conflicts: # testproject/ProjectSettings/EditorBuildSettings.asset
…est/multiprocess-tests/execute-step-in-context * test/multiprocess-tests/base-multiprocess-tests: proper rename for scene rename for test scene Update testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs rename test scene # changing root menu PR suggestions no longer ignore '[Ss]treamingAssets/buildInfo.txt' feat: network animator Trigger parameter support (#872)
…est/multiprocess-tests/adding-perf-tests-for-spawn * test/multiprocess-tests/execute-step-in-context: proper rename for scene rename for test scene Update testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs rename test scene # changing root menu PR suggestions no longer ignore '[Ss]treamingAssets/buildInfo.txt' feat: network animator Trigger parameter support (#872) # Conflicts: # testproject/Assets/Tests/Runtime/MultiprocessRuntime.meta # testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers.meta # testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs
…to test/multiprocess-tests/adding-doc-on-how-to-use * test/multiprocess-tests/adding-perf-tests-for-spawn: proper rename for scene rename for test scene Update testproject/Assets/Tests/Runtime/MultiprocessRuntime/Helpers/BuildMultiprocessTestPlayer.cs rename test scene # changing root menu PR suggestions no longer ignore '[Ss]treamingAssets/buildInfo.txt' feat: network animator Trigger parameter support (#872)
…nsform * develop: test: Perf tests part 3. Adding ExecuteStepInContext for better test readability (#924) test: Perf tests part 2. Adding Test Coordinator and base test class (#923) fix: (MLAPI.Serialization) 'specified cast is not valid.' on NetworkW… (#951) test: Perf tests part 1. Basis for multiprocess tests process orchestration. (#922) feat: network animator Trigger parameter support (#872)
Epic Link: https://jira.unity3d.com/browse/MTT-586
Added functionality:
Improvements:
Fixes:
https://jira.unity3d.com/browse/MTT-715 - we are no longer syncing parameters that are driven by animation curves. These parameters are being indirectly set when we sync layer state, so no reason to sync these.
I have also removed the ability to pick parameters of the animator that are being synced - all of them are synced now.
In order to implement the logic that can capture the value of Animator Trigger parameters we have to poll for these values on every frame - Trigger values are transient and can be consumed by the Mecanim internals at any update after they are set to True, thus making it impossible for us to actually detect them being flipped on. Thus we poll for Trigger changes in
FixedUpdate
- this point in Unity update loop currently seems to be the best time to check for Triggers regardless of the update type the Animator is using.In order to check the value of a Trigger we rely on an undocumented feature of
Animator.GetBool
that will retrieve the value of the Trigger as though it was a bool (which it actually is, just with an added semantic of being immediately reset to False).Initially an attempt was made to avoid syncing parameters at all and to just sync the Animator layer state, but it turned out to be insufficient to make the Animator on the other side to correctly replicate the visuals - Animator parameters are being re-evaluated by the update loop of Mecanim state machine, which happens every frame - and if the parameters aren't in sync, then certain undesirable transitions could be happening, thus breaking the animations on the non-auth peers' side.
In order to play with the new animator:
Do the same in Editor (or start Play mode from
Assets/Tests/Manual/NetworkAnimatorTests/NetworkAnimatorEnhancement.unity
scene).