Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jimdroberts committed May 18, 2023
2 parents 728454d + ad175ef commit 2beb1b0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ internal virtual void Despawn(NetworkObject nob, DespawnType despawnType, bool a
/* If client-host has visibility
* then disable and wait for client-host to get destroy
* message. Otherwise destroy immediately. */
if (nob.Observers.Contains(NetworkManager.ClientManager.Connection))
if (NetworkManager.IsHost && nob.Observers.Contains(NetworkManager.ClientManager.Connection))
NetworkManager.ServerManager.Objects.AddToPending(nob);
else
destroy = true;
Expand Down
3 changes: 2 additions & 1 deletion FishMMO/Assets/FishNet/Runtime/Object/NetworkObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,8 @@ internal void Deinitialize(bool asServer)

if (asServer)
{
IsDeinitializing = true;
NetworkObserver?.Deinitialize(false);
IsDeinitializing = true;
}
else
{
Expand Down
13 changes: 9 additions & 4 deletions FishMMO/Assets/FishNet/Runtime/Observing/NetworkObserver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ internal void Initialize(NetworkObject networkObject)
{
observerFound = true;

/* Make an instance of each condition so values are
/* Make an instance of each condition so values are
* not overwritten when the condition exist more than
* once in the scene. Double edged sword of using scriptable
* objects for conditions. */
_observerConditions[i] = _observerConditions[i].Clone();
ObserverCondition oc = _observerConditions[i];
oc.Initialize(_networkObject);
ObserverCondition oc = _observerConditions[i].Clone();
_observerConditions[i] = oc;

//If timed also register as containing timed conditions.
if (oc.Timed())
_timedConditions.Add(oc);
Expand All @@ -200,6 +200,11 @@ internal void Initialize(NetworkObject networkObject)
return;
}

for (int i = 0; i < _observerConditions.Count; i++)
{
_observerConditions[i].Initialize(networkObject);
}


RegisterTimedConditions();
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2beb1b0

Please sign in to comment.