com.unity.netcode.gameobjects@1.0.0-pre.5

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Additional documentation and release notes are available at [Multiplayer Documentation](https://docs-multiplayer.unity3d.com).

## [1.0.0-pre.5] - 2022-01-26

### Added

- Added `PreviousValue` in `NetworkListEvent`, when `Value` has changed (#1528)

### Changed

- NetworkManager's GameObject is no longer allowed to be nested under one or more GameObject(s).(#1484)
- NetworkManager DontDestroy property was removed and now NetworkManager always is migrated into the DontDestroyOnLoad scene. (#1484)

### Fixed

- Fixed network tick value sometimes being duplicated or skipped. (#1614)
- Fixed The ClientNetworkTransform sample script to allow for owner changes at runtime. (#1606)
This commit is contained in:
Unity Technologies
2022-01-26 00:00:00 +00:00
parent 36d07fad5e
commit 4818405514
17 changed files with 403 additions and 39 deletions

View File

@@ -272,18 +272,22 @@ namespace Unity.Netcode
{
reader.ReadValueSafe(out int index);
reader.ReadValueSafe(out T value);
if (index < m_List.Length)
if (index >= m_List.Length)
{
m_List[index] = value;
throw new Exception("Shouldn't be here, index is higher than list length");
}
var previousValue = m_List[index];
m_List[index] = value;
if (OnListChanged != null)
{
OnListChanged(new NetworkListEvent<T>
{
Type = eventType,
Index = index,
Value = value
Value = value,
PreviousValue = previousValue
});
}
@@ -293,7 +297,8 @@ namespace Unity.Netcode
{
Type = eventType,
Index = index,
Value = value
Value = value,
PreviousValue = previousValue
});
}
}
@@ -368,7 +373,7 @@ namespace Unity.Netcode
public bool Contains(T item)
{
int index = NativeArrayExtensions.IndexOf(m_List, item);
return index == -1;
return index != -1;
}
/// <inheritdoc />
@@ -528,6 +533,11 @@ namespace Unity.Netcode
/// </summary>
public T Value;
/// <summary>
/// The previous value when "Value" has changed, if available.
/// </summary>
public T PreviousValue;
/// <summary>
/// the index changed, added or removed if available
/// </summary>