Skip to content

Commit

Permalink
4.5.1
Browse files Browse the repository at this point in the history
- Fixed nested scene NetworkObjects not spawning (#791).
- Added 'Rebuild Selected Scene's Ids' (#789).
- Improved SyncList, removed unused code. (#785).
- Fixed incorrect equality check in SyncList.Set (#784).
- Improved readability for clientHost renderer update methods.
- Improved Dictionaries utilities, removed unused code.
- Fixed collection modified error in ServerObjects.Observers, introduced in 4.5.0 dev branch.
- Fixed NetworkTransform sometimes causing null reference errors with predicted spawning (#792).
- Fixed predicted spawning no longer sends spawn message back to predicted spawner; only confirmation message.
- Improved removed unused code in NetworkAnimator.
- Fixed null check order on NetworkAnimator._canSynchronizeAnimator (#794).
  • Loading branch information
FirstGearGames committed Oct 12, 2024
1 parent 3e0cde9 commit 758335c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
using FishNet.Editing.PrefabCollectionGenerator;
using FishNet.Object;
using FishNet.Utility.Extension;
using FishNet.Utility.Performance;
using GameKit.Dependencies.Utilities;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;

Expand All @@ -20,7 +20,7 @@ public static void ShowConfiguration()
SettingsService.OpenProjectSettings("Project/Fish-Networking/Configuration");
}

}
}

public class DeveloperMenu : MonoBehaviour
{
Expand Down Expand Up @@ -103,6 +103,8 @@ private static bool RemoveOrAddDefine(string define, bool removeDefine)

}



public class RebuildSelectedSceneIdsMenu : MonoBehaviour {
/// <summary>
/// Rebuilds sceneIds for open scenes.
Expand All @@ -111,7 +113,7 @@ public class RebuildSelectedSceneIdsMenu : MonoBehaviour {
public static void RebuildSelectedScenesSceneIds()
{
SceneAsset[] selectedScenes = Selection.GetFiltered<SceneAsset>(SelectionMode.Assets);
// Debug.Log(selectedScenes.Length);
//Thanks FREEZX
for (int i = 0; i < selectedScenes.Length; ++i) {
string path = AssetDatabase.GetAssetPath(selectedScenes[i]);
Scene scene = EditorSceneManager.OpenScene(path, OpenSceneMode.Single);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,19 +329,19 @@ public ParameterDetail(AnimatorControllerParameter controllerParameter, byte typ
/// <summary>
/// All parameter values, excluding triggers.
/// </summary>
private List<ParameterDetail> _parameterDetails = new();
private readonly List<ParameterDetail> _parameterDetails = new();
/// <summary>
/// Last int values.
/// </summary>
private List<int> _ints = new();
private readonly List<int> _ints = new();
/// <summary>
/// Last float values.
/// </summary>
private List<float> _floats = new();
private readonly List<float> _floats = new();
/// <summary>
/// Last bool values.
/// </summary>
private List<bool> _bools = new();
private readonly List<bool> _bools = new();
/// <summary>
/// Last layer weights.
/// </summary>
Expand All @@ -353,21 +353,25 @@ public ParameterDetail(AnimatorControllerParameter controllerParameter, byte typ
/// <summary>
/// Trigger values set by using SetTrigger and ResetTrigger.
/// </summary>
private List<TriggerUpdate> _triggerUpdates = new();
/// <summary>
/// Updates going to clients.
/// </summary>
private List<byte[]> _toClientsBuffer = new();
private readonly List<TriggerUpdate> _triggerUpdates = new();
// /// <summary>
// /// Updates going to clients.
// /// </summary>
// private List<byte[]> _toClientsBuffer = new();
/// <summary>
/// Returns if the animator is exist and can be synchronized.
/// </summary>
private bool _canSynchronizeAnimator
{
get
{
bool enabled = _animator && (_animator.enabled || _synchronizeWhenDisabled);
bool failedChecks = (!_isAnimatorSet || !enabled);
return !failedChecks;
if (!_isAnimatorSet)
return false;

if (_animator.enabled || _synchronizeWhenDisabled)
return true;

return false;
}
}
/// <summary>
Expand Down Expand Up @@ -498,14 +502,14 @@ public override void OnStartServer()
if (_clientAuthoritative)
{
_clientAuthoritativeUpdates = new();
//Expand to clients buffer count to however many buffers can be held.
for (int i = 0; i < ClientAuthoritativeUpdate.MAXIMUM_BUFFER_COUNT; i++)
_toClientsBuffer.Add(new byte[0]);
}
else
{
_toClientsBuffer.Add(new byte[0]);
// //Expand to clients buffer count to however many buffers can be held.
// for (int i = 0; i < ClientAuthoritativeUpdate.MAXIMUM_BUFFER_COUNT; i++)
// _toClientsBuffer.Add(new byte[0]);
}
// else
// {
// _toClientsBuffer.Add(new byte[0]);
// }
}

public override void OnStartClient()
Expand Down
4 changes: 3 additions & 1 deletion Assets/FishNet/Runtime/Object/Synchronizing/SyncList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,10 @@ public void Dirty(int index)
if (!base.CanNetworkSetValues(true))
return;

// bool asServer = true;
T value = Collection[index];
AddOperation(SyncListOperation.Set, index, value, value);
// if (asServer)
AddOperation(SyncListOperation.Set, index, value, value);
}
/// <summary>
/// Sets value at index.
Expand Down

0 comments on commit 758335c

Please sign in to comment.