File tree Expand file tree Collapse file tree
com.unity.netcode.gameobjects/Tests/Runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,8 +30,12 @@ public static NetworkObject GetNetworkObjectById(ulong networkObjectId)
3030 return null ;
3131 }
3232
33+ public NetworkList < int > MyNetworkList = new NetworkList < int > ( ) ;
34+
3335 public override void OnNetworkSpawn ( )
3436 {
37+ MyNetworkList . OnListChanged += Changed ;
38+
3539 if ( NetworkManager . LocalClientId == ClientIdToTarget )
3640 {
3741 ClientTargetedNetworkObjects . Add ( this ) ;
@@ -48,14 +52,6 @@ public override void OnNetworkDespawn()
4852 base . OnNetworkDespawn ( ) ;
4953 }
5054
51- public NetworkList < int > MyNetworkList ;
52-
53- private void Start ( )
54- {
55- MyNetworkList = new NetworkList < int > ( ) ;
56- MyNetworkList . OnListChanged += Changed ;
57- }
58-
5955 public void Changed ( NetworkListEvent < int > listEvent )
6056 {
6157 Debug . Log ( $ "listEvent.Type is { listEvent . Type } ") ;
You can’t perform that action at this time.
0 commit comments