You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature: allow NetworkBehaviour components in children. solves #2276 (#3486)
* feature: allow child NetworkBehaviour components in children
* Tanks demo: move Turret NetworkTransform to child
* NT TODO
* RequireInParents NI
* NetworkAnimatore allow in children
* call base onvalidate
* Add OnValidate to Script Template
* fix for pre-2020.3 Unity
* MirrorTest: CreateNetworked with NetworkBehaviour in children
* Tests: child networkbehaviours
---------
Co-authored-by: MrGadget1024 <9826063+MrGadget1024@users.noreply.github.com>
Copy file name to clipboardExpand all lines: Assets/Mirror/Components/NetworkAnimator.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,8 @@ namespace Mirror
13
13
/// <para>If the object has authority on the server, then it should be animated on the server and state information will be sent to all clients. This is common for objects not related to a specific client, such as an enemy unit.</para>
14
14
/// <para>The NetworkAnimator synchronizes all animation parameters of the selected Animator. It does not automatically synchronize triggers. The function SetTrigger can by used by an object with authority to fire an animation trigger on other clients.</para>
15
15
/// </remarks>
16
+
// [RequireComponent(typeof(NetworkIdentity))] disabled to allow child NetworkBehaviours
// TODO this field is kind of unnecessary since we now support child NetworkBehaviours
28
29
[Header("Target")]
29
30
[Tooltip("The Transform component to sync. May be on on this GameObject, or on a child.")]
30
31
publicTransformtarget;
@@ -67,17 +68,17 @@ public abstract class NetworkTransformBase : NetworkBehaviour
67
68
publicbooltimelineOffset=false;
68
69
69
70
// Ninja's Notes on offset & mulitplier:
70
-
//
71
+
//
71
72
// In a no multiplier scenario:
72
73
// 1. Snapshots are sent every frame (frame being 1 NM send interval).
73
74
// 2. Time Interpolation is set to be 'behind' by 2 frames times.
74
75
// In theory where everything works, we probably have around 2 snapshots before we need to interpolate snapshots. From NT perspective, we should always have around 2 snapshots ready, so no stutter.
75
-
//
76
+
//
76
77
// In a multiplier scenario:
77
78
// 1. Snapshots are sent every 10 frames.
78
79
// 2. Time Interpolation remains 'behind by 2 frames'.
79
-
// When everything works, we are receiving NT snapshots every 10 frames, but start interpolating after 2.
80
-
// Even if I assume we had 2 snapshots to begin with to start interpolating (which we don't), by the time we reach 13th frame, we are out of snapshots, and have to wait 7 frames for next snapshot to come. This is the reason why we absolutely need the timestamp adjustment. We are starting way too early to interpolate.
80
+
// When everything works, we are receiving NT snapshots every 10 frames, but start interpolating after 2.
81
+
// Even if I assume we had 2 snapshots to begin with to start interpolating (which we don't), by the time we reach 13th frame, we are out of snapshots, and have to wait 7 frames for next snapshot to come. This is the reason why we absolutely need the timestamp adjustment. We are starting way too early to interpolate.
Debug.LogError($"'{name}' has {identities.Length} NetworkIdentity components. There should only be one NetworkIdentity, and it must be on the root object.");
373
+
}
374
+
}
375
+
355
376
voidAssignAssetID(stringpath)
356
377
{
357
378
// only set if not empty. fixes https://github.com/vis2k/Mirror/issues/2765
0 commit comments