Skip to content

Commit ea66904

Browse files
Merge branch 'develop-2.0.0' into feat/attachable-networkbehaviour-and-object-controller
2 parents db4adab + e7b14c2 commit ea66904

File tree

9 files changed

+162
-6
lines changed

9 files changed

+162
-6
lines changed

.yamato/_run-all.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ run_quick_checks:
1717
dependencies:
1818
- .yamato/package-pack.yml#package_pack_-_ngo_ubuntu
1919
- .yamato/project-standards.yml#standards_ubuntu_testproject_trunk
20+
# Run API validation to early-detect all new APIs that would force us to release new minor version of the package. Note that for this to work the package version in package.json must correspond to "actual package state" which means that it should be higher than last released version
21+
- .yamato/vetting-test.yml#vetting_test
2022

2123

2224
# Runs all package tests

.yamato/_triggers.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ develop_nightly:
106106
# Build player for webgl platform on trunk and 6000.0 editors
107107
- .yamato/project-updated-dependencies-test.yml#updated-dependencies_testproject_NGO_ubuntu_trunk
108108
- .yamato/project-updated-dependencies-test.yml#updated-dependencies_testproject_NGO_win_6000.0
109+
# Run API validation to early-detect all new APIs that would force us to release new minor version of the package. Note that for this to work the package version in package.json must correspond to "actual package state" which means that it should be higher than last released version
110+
- .yamato/vetting-test.yml#vetting_test
109111

110112

111113
# Run all tests on weekly bases

.yamato/package-pack.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ package_pack_-_ngo_{{ platform.name }}:
3737
variables:
3838
XRAY_PROFILE: "gold ./pvpExceptions.json"
3939
commands:
40+
- python Tools/scripts/release.py # Needed to ensure that CHANGELOG is properly formatted for this test due to the fact that we have bumped package version (to properly perform vetting tests)
4041
- upm-pvp pack "com.unity.netcode.gameobjects" --output upm-ci~/packages
4142
- upm-pvp xray --packages "upm-ci~/packages/com.unity.netcode.gameobjects*.tgz" --results pvp-results
4243
- upm-pvp require {% if platform.name == "win" %}"%XRAY_PROFILE%"{% else %}"$XRAY_PROFILE"{% endif %} --results pvp-results --allow-missing

.yamato/project.metafile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ validation_editors:
159159
- 6000.1
160160
- 6000.2
161161
- trunk
162+
minimal:
163+
- 6000.0
162164

163165

164166
# Scripting backends used by Standalone RunTimeTests---------------------------------------------------

.yamato/vetting-test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{% metadata_file .yamato/project.metafile %} # All configuration that is used to create different configurations (used in for loops) is taken from this file.
2+
---
3+
# DESCRIPTION--------------------------------------------------------------------------
4+
# This configuration defines vetting tests for the Tools package which allows to validate if the package is in releasable state. This is important in particular because of API validation that allows to detect if we are introducing any new APIs that will force us to bump package version to new minor
5+
# If this test fails with new API error we should either make those API internal OR bump package version to new minor (note that the package version reflects the current package state)
6+
7+
# Note that we are packing the package only (no project context) so if package have any soft dependencies then project should be used to test it (to enable those APIs)
8+
{% for editor in validation_editors.minimal -%}
9+
vetting_test:
10+
name: MP Tools - Vetting Test (Win, {{editor}} LTS)
11+
agent: { type: Unity::VM, flavor: b1.large, image: package-ci/win11:v4 }
12+
commands:
13+
- python Tools/scripts/release.py # Needed to ensure that CHANGELOG is properly formatted for this test
14+
- npm install -g "upm-ci-utils@stable" --registry https://artifactory.prd.it.unity3d.com/artifactory/api/npm/upm-npm
15+
- unity-downloader-cli --fast --wait --unity-version {{ editor }} --components editor --arch x64
16+
- upm-ci package pack --package-path com.unity.netcode.gameobjects
17+
- upm-ci package test -u .Editor --package-path com.unity.netcode.gameobjects --type vetting-tests
18+
artifacts:
19+
logs:
20+
paths:
21+
- pvp-results/*
22+
- test-results/**
23+
- upm-ci~/test-results/**
24+
- upm-ci~/upm-ci.log
25+
{% endfor -%}

Tools/scripts/release.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""
2+
This python script makes the NGO package release ready. What it does is:
3+
1) Update changelogs
4+
2) Update validation exception file based on manifest version
5+
6+
Note that this script NEEDS TO BE RUN FROM THE ROOT of the project.
7+
"""
8+
#!/usr/bin/env python3
9+
import datetime
10+
import json
11+
import os
12+
import re
13+
import subprocess
14+
import platform
15+
16+
package_name = 'com.unity.netcode.gameobjects'
17+
18+
def update_changelog(new_version):
19+
"""
20+
Cleans the [Unreleased] section of the changelog by removing empty subsections,
21+
then replaces the '[Unreleased]' tag with the new version and release date.
22+
"""
23+
24+
changelog_entry = f'## [{new_version}] - {datetime.date.today().isoformat()}'
25+
changelog_path = f'{package_name}/CHANGELOG.md'
26+
print("Latest CHANGELOG entry will be modified to: " + changelog_entry)
27+
28+
with open(changelog_path, 'r', encoding='UTF-8') as f:
29+
changelog_text = f.read()
30+
31+
# This pattern finds a line starting with '###', followed by its newline,
32+
# and then two more lines that contain only whitespace.
33+
# The re.MULTILINE flag allows '^' to match the start of each line.
34+
pattern = re.compile(r"^###.*\n\n\n", re.MULTILINE)
35+
36+
# Replace every match with an empty string. The goal is to remove empty CHANGELOG subsections.
37+
cleaned_content = pattern.sub('', changelog_text)
38+
39+
# Replace the [Unreleased] section with the new version + cleaned subsections
40+
changelog_text = re.sub(r'## \[Unreleased\]', changelog_entry, cleaned_content)
41+
42+
# Write the changes
43+
with open(changelog_path, 'w', encoding='UTF-8', newline='\n') as file:
44+
file.write(changelog_text)
45+
46+
47+
def update_validation_exceptions(new_version):
48+
"""
49+
Updates the ValidationExceptions.json file with the new package version.
50+
"""
51+
52+
validation_file = f'{package_name}/ValidationExceptions.json'
53+
54+
# If files do not exist, exit
55+
if not os.path.exists(validation_file):
56+
return
57+
58+
# Update the PackageVersion in the exceptions
59+
with open(validation_file, 'rb') as f:
60+
json_text = f.read()
61+
data = json.loads(json_text)
62+
updated = False
63+
for exceptionElements in ["WarningExceptions", "ErrorExceptions"]:
64+
exceptions = data.get(exceptionElements)
65+
66+
if exceptions is not None:
67+
for exception in exceptions:
68+
if 'PackageVersion' in exception:
69+
exception['PackageVersion'] = new_version
70+
updated = True
71+
72+
# If no exceptions were updated, we do not need to write the file
73+
if not updated:
74+
return
75+
76+
with open(validation_file, 'w', encoding='UTF-8', newline='\n') as json_file:
77+
json.dump(data, json_file, ensure_ascii=False, indent=2)
78+
json_file.write("\n") # Add newline cause Py JSON does not
79+
print(f" updated `{validation_file}`")
80+
81+
82+
def get_manifest_json_version(filename):
83+
"""
84+
Reads the package.json file and returns the version specified in it.
85+
"""
86+
with open(filename, 'rb') as f:
87+
json_text = f.read()
88+
data = json.loads(json_text)
89+
90+
return data['version']
91+
92+
93+
if __name__ == '__main__':
94+
manifest_path = f'{package_name}/package.json'
95+
package_version = get_manifest_json_version(manifest_path)
96+
97+
# Update the ValidationExceptions.json file
98+
# with the new package version OR remove it if not a release branch
99+
update_validation_exceptions(package_version)
100+
# Clean the CHANGELOG and add latest entry
101+
update_changelog(package_version)

com.unity.netcode.gameobjects/CHANGELOG.md

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

1111
### Added
1212

13+
14+
### Fixed
15+
16+
- Fixed issue where viewing a `NetworkBehaviour` with one or more `NetworkVariable` fields could throw an exception if running a distributed authority network topology with a local (DAHost) host and viewed on the host when the host is not the authority of the associated `NetworkObject`. (#3578)
17+
- Fixed issue when using a distributed authority network topology and viewing a `NetworkBehaviour` with one or more `NetworkVariable` fields in the inspector view would not show editable fields. (#3578)
18+
19+
### Changed
20+
21+
22+
## [2.5.0] - 2025-08-01
23+
24+
### Added
25+
1326
- Added serializer for `Pose` (#3546)
1427
- Added `AttachableBehaviour` helper component to provide an alternate approach to parenting items without using the `NetworkObject` parenting. (#3518)
1528
- Added `AttachableNode` helper component that is used by `AttachableBehaviour` as the target node for parenting. (#3518)

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

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,21 @@ public bool IsSessionOwner
529529

530530
internal bool IsBehaviourEditable()
531531
{
532-
// Only server can MODIFY. So allow modification if network is either not running or we are server
533-
return !m_NetworkObject ||
534-
m_NetworkObject.NetworkManager == null ||
535-
m_NetworkObject.NetworkManager.IsListening == false ||
536-
m_NetworkObject.NetworkManager.IsServer;
532+
if (!m_NetworkObject)
533+
{
534+
return true;
535+
}
536+
537+
if (!m_NetworkObject.NetworkManager)
538+
{
539+
return true;
540+
}
541+
542+
var networkManager = m_NetworkObject.NetworkManager;
543+
544+
// Only the authority can MODIFY. So allow modification if network is either not running or we are the authority.
545+
return !networkManager.IsListening ||
546+
((networkManager.DistributedAuthorityMode && m_NetworkObject.IsOwner) || (!networkManager.DistributedAuthorityMode && networkManager.IsServer));
537547
}
538548

539549
// TODO: this needs an overhaul. It's expensive, it's ja little naive in how it looks for networkObject in

com.unity.netcode.gameobjects/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "com.unity.netcode.gameobjects",
33
"displayName": "Netcode for GameObjects",
44
"description": "Netcode for GameObjects is a high-level netcode SDK that provides networking capabilities to GameObject/MonoBehaviour workflows within Unity and sits on top of underlying transport layer.",
5-
"version": "2.4.4",
5+
"version": "2.5.0",
66
"unity": "6000.0",
77
"dependencies": {
88
"com.unity.nuget.mono-cecil": "1.11.4",

0 commit comments

Comments
 (0)