Skip to content

Commit bee700f

Browse files
style
Fixing a comment. Adding additional comments.
1 parent 202e005 commit bee700f

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviour.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,11 @@ public virtual void OnNetworkPreDespawn() { }
753753

754754
internal virtual void InternalOnNetworkPreSpawn(ref NetworkManager networkManager) { }
755755

756+
/// <summary>
757+
/// Handles pre-spawn related initializations.
758+
/// Invokes any <see cref="InternalOnNetworkPreSpawn"/> subscriptions.
759+
/// Finally invokes <see cref="OnNetworkPreSpawn(ref NetworkManager)"/>.
760+
/// </summary>
756761
internal void NetworkPreSpawn(ref NetworkManager networkManager, NetworkObject networkObject)
757762
{
758763
m_NetworkObject = networkObject;
@@ -781,13 +786,19 @@ internal void NetworkPreSpawn(ref NetworkManager networkManager, NetworkObject n
781786
}
782787

783788
/// <summary>
784-
/// Handles the initialization of all child <see cref="NetworkBehaviour"/>s.
789+
/// Initializes the:
790+
/// - <see cref="IsSpawned"/> state.
791+
/// - <see cref="NetworkVariableBase"/> instances.
792+
/// - Spawned related properties are applied.
793+
/// !! Note !!:
794+
/// This also populates RPC related tables based on this <see cref="NetworkBehaviour"/>'s RPCs (if any).
785795
/// </summary>
786796
internal void InternalOnNetworkSpawn()
787797
{
788798
IsSpawned = true;
789-
// Initialize the NetworkVariables so they are accessible in OnNetworkSpawn;
799+
// Initialize the NetworkVariables and **RPC tables** so they are accessible in OnNetworkSpawn
790800
InitializeVariables();
801+
// Apply the spawned state/properties to this instance
791802
UpdateNetworkProperties();
792803
}
793804

@@ -817,6 +828,9 @@ internal void NetworkSpawn()
817828
}
818829
}
819830

831+
/// <summary>
832+
/// Handles invoking <see cref="OnNetworkPostSpawn"/>.
833+
/// </summary>
820834
internal void NetworkPostSpawn()
821835
{
822836
try
@@ -830,6 +844,9 @@ internal void NetworkPostSpawn()
830844
}
831845
}
832846

847+
/// <summary>
848+
/// Handles invoking <see cref="OnNetworkSessionSynchronized"/>.
849+
/// </summary>
833850
internal void NetworkSessionSynchronized()
834851
{
835852
try
@@ -843,6 +860,9 @@ internal void NetworkSessionSynchronized()
843860
}
844861
}
845862

863+
/// <summary>
864+
/// Handles invoking <see cref="OnInSceneObjectsSpawned"/>.
865+
/// </summary>
846866
internal void InSceneNetworkObjectsSpawned()
847867
{
848868
try
@@ -855,6 +875,9 @@ internal void InSceneNetworkObjectsSpawned()
855875
}
856876
}
857877

878+
/// <summary>
879+
/// Handles invoking <see cref="OnNetworkPreDespawn"/>.
880+
/// </summary>
858881
internal void InternalOnNetworkPreDespawn()
859882
{
860883
try
@@ -867,6 +890,9 @@ internal void InternalOnNetworkPreDespawn()
867890
}
868891
}
869892

893+
/// <summary>
894+
/// Handles invoking <see cref="OnNetworkDespawn"/>.
895+
/// </summary>
870896
internal void InternalOnNetworkDespawn()
871897
{
872898
IsSpawned = false;

0 commit comments

Comments
 (0)