Skip to content

Commit 4ed1ce5

Browse files
committed
Fixed cache bug and NetworkedProximity bug
1 parent 24d8636 commit 4ed1ce5

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

MLAPI/MonoBehaviours/Core/NetworkedBehaviour.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,6 @@ private void OnEnable()
109109
if (_networkedObject == null)
110110
_networkedObject = GetComponentInParent<NetworkedObject>();
111111

112-
if (NetworkingManager.singleton != null)
113-
CacheAttributedMethods();
114-
else
115-
NetworkingManager.onSingletonSet += CacheAttributedMethods;
116-
117112
NetworkedObject.NetworkedBehaviours.Add(this);
118113
}
119114

@@ -124,6 +119,10 @@ private void OnEnable()
124119
public virtual void NetworkStart()
125120
{
126121

122+
}
123+
internal void InternalNetworkStart()
124+
{
125+
CacheAttributedMethods();
127126
}
128127
/// <summary>
129128
/// Gets called when SyncedVars gets updated

MLAPI/MonoBehaviours/Core/NetworkedObject.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ internal void InvokeBehaviourNetworkSpawn()
274274
//We check if we are it's networkedObject owner incase a networkedObject exists as a child of our networkedObject.
275275
if(!childNetworkedBehaviours[i].networkedStartInvoked)
276276
{
277+
childNetworkedBehaviours[i].InternalNetworkStart();
277278
childNetworkedBehaviours[i].NetworkStart();
278279
childNetworkedBehaviours[i].SyncVarInit();
279280
childNetworkedBehaviours[i].networkedStartInvoked = true;

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public bool IsClientConnected
164164
/// An inspector bool that acts as a Trigger for regenerating RSA keys. Should not be used outside Unity editor.
165165
/// </summary>
166166
public bool RegenerateRSAKeys = false;
167-
internal static Action onSingletonSet;
168167

169168
private void OnValidate()
170169
{
@@ -644,8 +643,6 @@ private void OnEnable()
644643
DontDestroyOnLoad(gameObject);
645644
if (RunInBackground)
646645
Application.runInBackground = true;
647-
648-
onSingletonSet();
649646
}
650647

651648
private void OnDestroy()

MLAPI/MonoBehaviours/Prototyping/NetworkedProximity.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public override bool OnRebuildObservers(HashSet<uint> observers)
9191
// The reason it's not cleared is so that you don't have to iterate over your things if you simply
9292
// Have an event driven system where you want to remove a player. Ex if they leave a zone
9393
observers.Clear();
94-
observers = new HashSet<uint>();
9594

9695
if (ForceHidden)
9796
{

0 commit comments

Comments
 (0)