Skip to content

Commit 871d695

Browse files
Merge branch 'develop-2.0.0' into fix/localhost-resolution
2 parents 99b75f9 + 9f7a7a8 commit 871d695

File tree

6 files changed

+142
-56
lines changed

6 files changed

+142
-56
lines changed

.github/pull_request_template.md

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,61 @@
1-
<!-- Replace this block with what this PR does and why. Describe what you'd like reviewers to know, how you applied the engineering principles, and any interesting tradeoffs made. Delete bullet points below that don't apply, and update the changelog section as appropriate. -->
1+
## Purpose of this PR
2+
[//]: # (
3+
Replace this block with what this PR does and why. Describe what you'd like reviewers to know, how you applied the engineering principles, and any interesting tradeoffs made.
4+
)
25

3-
<!-- Add short version of the JIRA ticket to the PR title (e.g. "feat: new shiny feature [MTT-123]") -->
6+
### Jira ticket
7+
_Link to related jira ticket ([Use the smart commits](https://support.atlassian.com/bitbucket-cloud/docs/use-smart-commits/))_
48

5-
## Changelog
9+
### Changelog
10+
[//]: # (updated with all public facing changes - API changes, UI/UX changes, behaviour changes, bug fixes. Remove if not relevant.)
611

712
- Added: The package whose Changelog should be added to should be in the header. Delete the changelog section entirely if it's not needed.
8-
- Fixed: If you update multiple packages, create a new section with a new header for the other package.
9-
- Removed/Deprecated/Changed: Each bullet should be prefixed with Added, Fixed, Removed, Deprecated, or Changed to indicate where the entry should go.
10-
11-
## Testing and Documentation
12-
13-
- No tests have been added.
14-
- Includes unit tests.
15-
- Includes integration tests.
16-
- No documentation changes or additions were necessary.
17-
- Includes documentation for previously-undocumented public API entry points.
18-
- Includes edits to existing public API documentation.
13+
- Fixed: If you update multiple packages, create a new section with a new header for the other package.
14+
- Removed/Deprecated/Changed: Each bullet should be prefixed with Added, Fixed, Removed, Deprecated, or Changed to indicate where the entry should go
1915

2016
<!-- Uncomment and mark items off with a * if this PR deprecates any API:
2117
### Deprecated API
2218
- [ ] An `[Obsolete]` attribute was added along with a `(RemovedAfter yyyy-mm-dd)` entry.
23-
- [ ] An [api updater] was added.
19+
- [ ] An [api updater](https://confluence.unity3d.com/display/DEV/Obsolete+API+updaters) was added.
2420
- [ ] Deprecation of the API is explained in the CHANGELOG.
2521
- [ ] The users can understand why this API was removed and what they should use instead.
2622
-->
2723

28-
## Backport
24+
## Documentation
25+
[//]: # (
26+
This section is REQUIRED and should mention what documentation changes were following the changes in this PR.
27+
We should always evaluate if the changes in this PR require any documentation changes.
28+
)
2929

30-
<!-- If this is a backport:
31-
- Add the following to the PR title: "\[Backport\] ..." .
32-
- Link to the original PR.
33-
If this needs a backport - state this here
34-
If a backport is not needed please provide the reason why.
35-
If the "Backports" section is not present it will lead to a CI test failure.
36-
-->
30+
- No documentation changes or additions were necessary.
31+
- Includes documentation for previously-undocumented public API entry points.
32+
- Includes edits to existing public API documentation.
33+
34+
## Testing & QA
35+
[//]: # (
36+
This section is REQUIRED and should describe how the changes were tested and how should they be tested when Playtesting for the release.
37+
It can range from "edge case covered by unit tests" to "manual testing required and new sample was added".
38+
Expectation is that PR creator does some manual testing and provides a summary of it here.)
39+
40+
### Functional Testing
41+
[//]: # (If checked, List manual tests that have been performed.)
42+
_Manual testing :_
43+
- [ ] `Manual testing done`
44+
45+
_Automated tests:_
46+
- [ ] `Covered by existing automated tests`
47+
- [ ] `Covered by new automated tests`
48+
49+
_Does the change require QA team to:_
50+
51+
- [ ] `Review automated tests`?
52+
- [ ] `Execute manual tests`?
53+
54+
If any boxes above are checked, please add QA as a PR reviewer.
55+
56+
## Backport
57+
[//]: # (
58+
This section is REQUIRED and should link to the PR that targets other NGO version which is either develop or develop-2.0.0 branch
59+
Add the following to the PR title: "\[Backport\] ..."
60+
If this is not needed, for example feature specific to NGOv2.X, then just mention this fact.
61+
)

.github/workflows/backport-verification.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/pr-verification.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# This workflow is designed to verify that the pull request description contains a required sections that are important from quality perspective.
2+
# ## Backport section is important as a reminder to account for backports for anyone that works with NGO repository (to 1.X or 2.X branches respectively).
3+
# ## Testing & QA section is important to ensure that the PR has appropriate testing coverage and is important when QA will evaluate PRs before Playtesting for the release.
4+
# ## Documentation section is important to ensure that the documentation is updated with the changes made in the PR.
5+
6+
# If any of the sections is missing, the workflow will fail and block the PR from merging, prompting the developer to add those sections to the PR description.
7+
# The workflow is configured to run when PR is created as well as when it is edited which also counts simple description edits.
8+
9+
name: "NGO - PR Verification"
10+
11+
on:
12+
pull_request:
13+
types: [opened, edited, synchronize, reopened]
14+
branches:
15+
- develop
16+
- develop-2.0.0
17+
- release/*
18+
19+
jobs:
20+
pr-verification:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Check PR description
27+
uses: actions/github-script@v7
28+
with:
29+
script: |
30+
const pr = context.payload.pull_request;
31+
const body = pr.body || '';
32+
33+
// List of mandatory PR sections
34+
const requiredSections = [
35+
{
36+
header: '## Backport',
37+
description: 'PR description must include a "## Backport" section. Please add this section and provide information about this PR backport to develop or develop-2.0.0 branch respectively or explain why backport is not needed.'
38+
},
39+
{
40+
header: '## Testing & QA',
41+
description: 'PR description must include a "## Testing & QA" section. Please add this section and provide information about the testing performed for this PR. It can range from adding unit tests to full samples and is needed from QA side to analyze PRs while Playtesting for the release.'
42+
},
43+
{
44+
header: '## Documentation',
45+
description: 'PR description must include a "## Documentation" section. Please add this section and provide information about the documentation changes made in this PR. It is important to keep the documentation up to date with the code changes.'
46+
}
47+
];
48+
49+
const missing = requiredSections.filter(section => !body.includes(section.header));
50+
51+
if (missing.length > 0) {
52+
let message = 'PR description is missing the following required section(s):\n';
53+
54+
const missingDescriptions = missing.map(
55+
s => `- ${s.header}: ${s.description}`
56+
);
57+
58+
message += missingDescriptions.join('\n');
59+
message += '\n\nPlease add them to your PR description.';
60+
61+
core.setFailed(message);
62+
}

com.unity.netcode.gameobjects/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
1010

1111
### Added
1212

13+
- Added `AsNativeArray()` read‑only accessor to `NetworkList<T>` (#3567)
1314

1415
### Fixed
1516

@@ -20,6 +21,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
2021
### Changed
2122

2223
- Marked `UnityTransport.ConnectionAddressData.ServerEndPoint` as obsolete. It can't work when using hostnames as the server address, and its functionality can easily be replicated using `NetworkEndpoint.Parse`. (#3591)
24+
- Optimized `NetworkList<T>` indexer setter to skip operations when the new value equals the existing value, improving performance by avoiding unnecessary list events and network synchronization. (#3587)
2325

2426
## [2.5.0] - 2025-08-01
2527

@@ -32,6 +34,7 @@ Additional documentation and release notes are available at [Multiplayer Documen
3234

3335
### Fixed
3436

37+
- Removed allocation to the heap in NetworkBehaviourUpdate. (#3573)
3538
- Fixed issue where NetworkConfig.ConnectionData could cause the ConnectionRequestMessage to exceed the transport's MTU size and would result in a buffer overflow error. (#3564)
3639
- Fixed regression issue in v2.x where `NetworkObject.GetNetworkBehaviourAtOrderIndex` was converted from public to internal. (#3541)
3740
- Fixed ensuring OnValueChanged callback is still triggered on the authority when a collection changes and then reverts to the previous value in the same frame. (#3539)

com.unity.netcode.gameobjects/Runtime/Core/NetworkBehaviourUpdater.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ internal void NetworkBehaviourUpdate(bool forceSend = false)
3434
#endif
3535
try
3636
{
37-
m_DirtyNetworkObjects.UnionWith(m_PendingDirtyNetworkObjects);
37+
foreach (var dirtyNetworkObject in m_PendingDirtyNetworkObjects)
38+
{
39+
m_DirtyNetworkObjects.Add(dirtyNetworkObject);
40+
}
3841
m_PendingDirtyNetworkObjects.Clear();
3942

4043
// NetworkObject references can become null, when hidden or despawned. Once NUll, there is no point

com.unity.netcode.gameobjects/Runtime/NetworkVariable/Collections/NetworkList.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,13 @@ public T this[int index]
617617
}
618618

619619
var previousValue = m_List[index];
620+
621+
// Only trigger an event if the value has changed
622+
if (NetworkVariableSerialization<T>.AreEqual(ref previousValue, ref value))
623+
{
624+
return;
625+
}
626+
620627
m_List[index] = value;
621628

622629
var listEvent = new NetworkListEvent<T>()
@@ -631,6 +638,24 @@ public T this[int index]
631638
}
632639
}
633640

641+
/// <summary>
642+
/// Gets a **zero‑allocation**, <see cref="NativeArray{T}.ReadOnly"/> view over the current
643+
/// elements of this <see cref="NetworkList{T}"/>.
644+
/// </summary>
645+
/// <remarks>
646+
/// The returned array stays valid **only until** the list is mutated (add, remove,
647+
/// clear, resize) or <see cref="Dispose()"/> is called on the container. Continuing to use
648+
/// the array after it is invalid will result in undefined behaviour;
649+
/// callers are responsible for ensuring a safe lifetime.
650+
/// </remarks>
651+
/// <returns>
652+
/// A <see cref="NativeArray{T}.ReadOnly"/> reference that shares the same backing memory as this list.
653+
/// </returns>
654+
public NativeArray<T>.ReadOnly AsNativeArray()
655+
{
656+
return m_List.AsReadOnly();
657+
}
658+
634659
private void HandleAddListEvent(NetworkListEvent<T> listEvent)
635660
{
636661
m_DirtyEvents.Add(listEvent);

0 commit comments

Comments
 (0)