Skip to content

Commit b722b21

Browse files
chore: merge develop into 1.9.0 release (#2873)
1 parent f3dcae7 commit b722b21

14 files changed

+174
-79
lines changed

.yamato/mobile-build-and-test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build_{{ project.name }}_tests_{{ editor }}_android:
1212
flavor: b1.xlarge
1313
commands:
1414
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
15-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
15+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
1616
- python .yamato/disable-burst-if-requested.py --project-path testproject --platform Android
1717
- unity-downloader-cli -u {{ editor }} -c editor -c Android -w --fast
1818
- |
@@ -51,7 +51,7 @@ build_{{ project.name }}_tests_{{ editor }}_iOS:
5151
commands:
5252
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
5353
- unity-downloader-cli -u {{ editor }} -c editor -c iOS -w --fast
54-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
54+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
5555
- chmod +x ./utr
5656
- export UTR_VERSION=0.12.0
5757
- ./utr --artifacts_path=artifacts --timeout=1800 --testproject={{ project.name }} --editor-location=.Editor --suite=playmode --platform=iOS --build-only --player-save-path=build/players --extra-editor-arg=-batchmode --extra-editor-arg=-nographics --testfilter=Unity.Netcode.RuntimeTests
@@ -88,7 +88,7 @@ run_{{ project.name }}_tests_{{ editor }}_iOS:
8888
- .yamato/mobile-build-and-test.yml#build_{{ project.name }}_tests_{{ editor }}_iOS
8989
commands:
9090
# Download standalone UnityTestRunner
91-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
91+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr --output utr
9292
# Give UTR execution permissions
9393
- chmod +x ./utr
9494
# Run the test build on the device
@@ -127,7 +127,7 @@ run_{{ project.name }}_tests_{{ editor }}_android:
127127
dependencies:
128128
- .yamato/mobile-build-and-test.yml#build_{{ project.name }}_tests_{{ editor }}_android
129129
commands:
130-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
130+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
131131
- |
132132
set ANDROID_DEVICE_CONNECTION=%BOKKEN_DEVICE_IP%
133133
start %ANDROID_SDK_ROOT%\platform-tools\adb.exe connect %BOKKEN_DEVICE_IP%

.yamato/multiprocess-project-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ singlenode_multiprocess_test_testproject_{{ editor }}_{{ platform.name }}:
1515
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
1616
{% if editor != "trunk" %}
1717
- unity-downloader-cli -u {{ editor }} -c editor -w --fast
18-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr{% if platform.name == "win" %}.bat --output utr.bat{% endif %}{% if platform.name != "win" %} --output utr && chmod +x ./utr{% endif %}
18+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr{% if platform.name == "win" %}.bat --output utr.bat{% endif %}{% if platform.name != "win" %} --output utr && chmod +x ./utr{% endif %}
1919
- {{ platform.editorpath }} -projectpath testproject -batchmode -quit -nographics -logfile BuildMultiprocessTestPlayer.log -executeMethod Unity.Netcode.MultiprocessRuntimeTests.BuildMultiprocessTestPlayer.BuildRelease
2020
{% if platform.name == "mac" %} - sudo codesign --force --deep --sign - ./testproject/Builds/MultiprocessTests/MultiprocessTestPlayer.app{% endif %}
2121
- {{ platform.utr }} --suite=playmode --testproject=testproject --editor-location=.Editor --testfilter=Unity.Netcode.MultiprocessRuntimeTests --extra-editor-arg=-bypassIgnoreUTR

.yamato/standalone-project-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ standalone_tests_{{ project.name }}_{{ backend }}_{{ editor }}_{{ platform.name
1616
commands:
1717
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
1818
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
19-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr{% if platform.name == "win" %}.bat{% endif %} --output utr{% if platform.name == "win" %}.bat{% endif %}
19+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr{% if platform.name == "win" %}.bat{% endif %} --output utr{% if platform.name == "win" %}.bat{% endif %}
2020
{% if platform.name != "win" %}
2121
- chmod +x ./utr
2222
{% endif %}

.yamato/webgl-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ build_{{ project.name }}_tests_{{ editor }}_webgl:
1212
flavor: b1.xlarge
1313
commands:
1414
- pip install unity-downloader-cli --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
15-
- curl -s https://artifactory.prd.it.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
15+
- curl -s https://artifactory-slo.bf.unity3d.com/artifactory/unity-tools-local/utr-standalone/utr.bat --output utr.bat
1616
- python .yamato/disable-burst-if-requested.py --project-path testproject --platform WebGL
1717
- unity-downloader-cli -u {{ editor }} -c editor -c webgl -c il2cpp -w --fast
1818
- |

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,16 @@ Additional documentation and release notes are available at [Multiplayer Documen
2424

2525
### Fixed
2626

27+
- Fixed issue where NetworkTransformEditor would throw and exception if you excluded the physics package. (#2871)
28+
- Fixed issue where `NetworkTransform` could not properly synchronize its base position when using half float precision. (#2845)
2729
- Fixed issue where the host was not invoking `OnClientDisconnectCallback` for its own local client when internally shutting down. (#2822)
2830
- Fixed issue where NetworkTransform could potentially attempt to "unregister" a named message prior to it being registered. (#2807)
2931
- Fixed issue where in-scene placed `NetworkObject`s with complex nested children `NetworkObject`s (more than one child in depth) would not synchronize properly if WorldPositionStays was set to true. (#2796)
3032

3133
### Changed
3234

35+
- Changed `NetworkObjectReference` and `NetworkBehaviourReference` to allow null references when constructing and serializing. (#2874)
36+
- Changed `NetworkAnimator` no longer requires the `Animator` component to exist on the same `GameObject`. (#2872)
3337
- Changed `NetworkTransform` to now use `NetworkTransformMessage` as opposed to named messages for NetworkTransformState updates. (#2810)
3438
- Changed `CustomMessageManager` so it no longer attempts to register or "unregister" a null or empty string and will log an error if this condition occurs. (#2807)
3539

com.unity.netcode.gameobjects/Components/NetworkAnimator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ internal NetworkAnimatorStateChangeHandler(NetworkAnimator networkAnimator)
164164
/// NetworkAnimator enables remote synchronization of <see cref="UnityEngine.Animator"/> state for on network objects.
165165
/// </summary>
166166
[AddComponentMenu("Netcode/Network Animator")]
167-
[RequireComponent(typeof(Animator))]
168167
public class NetworkAnimator : NetworkBehaviour, ISerializationCallbackReceiver
169168
{
170169
[Serializable]

com.unity.netcode.gameobjects/Components/NetworkTransform.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,7 @@ private bool ShouldSynchronizeHalfFloat(ulong targetClientId)
14241424
/// <param name="targetClientId">the clientId being synchronized (both reading and writing)</param>
14251425
protected override void OnSynchronize<T>(ref BufferSerializer<T> serializer)
14261426
{
1427+
m_CachedNetworkManager = NetworkManager;
14271428
var targetClientId = m_TargetIdBeingSynchronized;
14281429
var synchronizationState = new NetworkTransformState()
14291430
{
@@ -2764,6 +2765,11 @@ public override void OnNetworkSpawn()
27642765
m_CachedNetworkManager = NetworkManager;
27652766

27662767
Initialize();
2768+
2769+
if (CanCommitToTransform && UseHalfFloatPrecision)
2770+
{
2771+
SetState(GetSpaceRelativePosition(), GetSpaceRelativeRotation(), GetScale(), false);
2772+
}
27672773
}
27682774

27692775
/// <inheritdoc/>

com.unity.netcode.gameobjects/Editor/NetworkTransformEditor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,10 @@ public override void OnInspectorGUI()
156156
}
157157
EditorGUILayout.PropertyField(m_UseHalfFloatPrecision);
158158

159-
#if COM_UNITY_MODULES_PHYSICS
160159
// if rigidbody is present but network rigidbody is not present
161160
var go = ((NetworkTransform)target).gameObject;
161+
162+
#if COM_UNITY_MODULES_PHYSICS
162163
if (go.TryGetComponent<Rigidbody>(out _) && go.TryGetComponent<NetworkRigidbody>(out _) == false)
163164
{
164165
EditorGUILayout.HelpBox("This GameObject contains a Rigidbody but no NetworkRigidbody.\n" +

com.unity.netcode.gameobjects/Runtime/Serialization/NetworkBehaviourReference.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public struct NetworkBehaviourReference : INetworkSerializable, IEquatable<Netwo
1111
{
1212
private NetworkObjectReference m_NetworkObjectReference;
1313
private ushort m_NetworkBehaviourId;
14+
private static ushort s_NullId = ushort.MaxValue;
1415

1516
/// <summary>
1617
/// Creates a new instance of the <see cref="NetworkBehaviourReference{T}"/> struct.
@@ -21,7 +22,9 @@ public NetworkBehaviourReference(NetworkBehaviour networkBehaviour)
2122
{
2223
if (networkBehaviour == null)
2324
{
24-
throw new ArgumentNullException(nameof(networkBehaviour));
25+
m_NetworkObjectReference = new NetworkObjectReference((NetworkObject)null);
26+
m_NetworkBehaviourId = s_NullId;
27+
return;
2528
}
2629
if (networkBehaviour.NetworkObject == null)
2730
{
@@ -60,6 +63,10 @@ public bool TryGet<T>(out T networkBehaviour, NetworkManager networkManager = nu
6063
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6164
private static NetworkBehaviour GetInternal(NetworkBehaviourReference networkBehaviourRef, NetworkManager networkManager = null)
6265
{
66+
if (networkBehaviourRef.m_NetworkBehaviourId == s_NullId)
67+
{
68+
return null;
69+
}
6370
if (networkBehaviourRef.m_NetworkObjectReference.TryGet(out NetworkObject networkObject, networkManager))
6471
{
6572
return networkObject.GetNetworkBehaviourAtOrderIndex(networkBehaviourRef.m_NetworkBehaviourId);

com.unity.netcode.gameobjects/Runtime/Serialization/NetworkObjectReference.cs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ namespace Unity.Netcode
1010
public struct NetworkObjectReference : INetworkSerializable, IEquatable<NetworkObjectReference>
1111
{
1212
private ulong m_NetworkObjectId;
13+
private static ulong s_NullId = ulong.MaxValue;
1314

1415
/// <summary>
1516
/// The <see cref="NetworkObject.NetworkObjectId"/> of the referenced <see cref="NetworkObject"/>.
@@ -24,13 +25,13 @@ public ulong NetworkObjectId
2425
/// Creates a new instance of the <see cref="NetworkObjectReference"/> struct.
2526
/// </summary>
2627
/// <param name="networkObject">The <see cref="NetworkObject"/> to reference.</param>
27-
/// <exception cref="ArgumentNullException"></exception>
2828
/// <exception cref="ArgumentException"></exception>
2929
public NetworkObjectReference(NetworkObject networkObject)
3030
{
3131
if (networkObject == null)
3232
{
33-
throw new ArgumentNullException(nameof(networkObject));
33+
m_NetworkObjectId = s_NullId;
34+
return;
3435
}
3536

3637
if (networkObject.IsSpawned == false)
@@ -45,16 +46,20 @@ public NetworkObjectReference(NetworkObject networkObject)
4546
/// Creates a new instance of the <see cref="NetworkObjectReference"/> struct.
4647
/// </summary>
4748
/// <param name="gameObject">The GameObject from which the <see cref="NetworkObject"/> component will be referenced.</param>
48-
/// <exception cref="ArgumentNullException"></exception>
4949
/// <exception cref="ArgumentException"></exception>
5050
public NetworkObjectReference(GameObject gameObject)
5151
{
5252
if (gameObject == null)
5353
{
54-
throw new ArgumentNullException(nameof(gameObject));
54+
m_NetworkObjectId = s_NullId;
55+
return;
5556
}
5657

57-
var networkObject = gameObject.GetComponent<NetworkObject>() ?? throw new ArgumentException($"Cannot create {nameof(NetworkObjectReference)} from {nameof(GameObject)} without a {nameof(NetworkObject)} component.");
58+
var networkObject = gameObject.GetComponent<NetworkObject>();
59+
if (!networkObject)
60+
{
61+
throw new ArgumentException($"Cannot create {nameof(NetworkObjectReference)} from {nameof(GameObject)} without a {nameof(NetworkObject)} component.");
62+
}
5863
if (networkObject.IsSpawned == false)
5964
{
6065
throw new ArgumentException($"{nameof(NetworkObjectReference)} can only be created from spawned {nameof(NetworkObject)}s.");
@@ -80,10 +85,14 @@ public bool TryGet(out NetworkObject networkObject, NetworkManager networkManage
8085
/// </summary>
8186
/// <param name="networkObjectRef">The reference.</param>
8287
/// <param name="networkManager">The networkmanager. Uses <see cref="NetworkManager.Singleton"/> to resolve if null.</param>
83-
/// <returns>The resolves <see cref="NetworkObject"/>. Returns null if the networkobject was not found</returns>
88+
/// <returns>The resolved <see cref="NetworkObject"/>. Returns null if the networkobject was not found</returns>
8489
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8590
private static NetworkObject Resolve(NetworkObjectReference networkObjectRef, NetworkManager networkManager = null)
8691
{
92+
if (networkObjectRef.m_NetworkObjectId == s_NullId)
93+
{
94+
return null;
95+
}
8796
networkManager = networkManager ?? NetworkManager.Singleton;
8897
networkManager.SpawnManager.SpawnedObjects.TryGetValue(networkObjectRef.m_NetworkObjectId, out NetworkObject networkObject);
8998

0 commit comments

Comments
 (0)