Infinite hang when reloading a scene contains a manually spawned NetworkObject with a SpriteLibrary and a SpriteResolver
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- csharp, unity
- Lĩnh vực
- game-dev, networking
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện thiết lập với NetworkManager, UnityTransport, InstantiateAndSpawn, SpriteLibrary, SpriteResolver và destroyWithScene được bật, sau đó theo dõi NetworkManager.SceneManager.LoadScene trong các lần tải lại liên tiếp. So sánh hành vi giữa các phiên bản Unity và Netcode được báo cáo; hoàn thành khi scene được tải lại sau mỗi 3 giây mà không khiến trình chỉnh sửa Unity bị treo.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Infinite hang when reloading a scene contains a manually spawned NetworkObject with a SpriteLibrary and a SpriteResolver
Reproduce Steps
- Create an empty scene
- Add a NetworkManager, with UnityTransport
- Create a new prefab with NetworkObject, SpriteRenderer, Animator, SpriteLibrary, SpriteResolver (following basically this tutorial: https://www.youtube.com/watch?v=4xPHqEEa-V0)
- Create an empty object
TestCrashwith the following code, and link the prefab from (3) in the inspector
public class TestCrash : NetworkBehaviour
{
[SerializeField] public GameObject prefab = null!;
private bool _alreadyCalled;
private void Start()
{
var networkManager = NetworkManager.Singleton;
var unityTransport = networkManager.GetComponent<UnityTransport>();
// Start local server
unityTransport.UseWebSockets = false; // if applicable
unityTransport.SetConnectionData("0.0.0.0", 7777);
networkManager!.NetworkConfig.NetworkTransport = unityTransport;
networkManager.StartHost();
NetworkManager.Singleton.SpawnManager.InstantiateAndSpawn(
prefab!.GetComponent<NetworkObject>(),
OwnerClientId,
destroyWithScene: true,
position: Vector3.zero
);
}
private void Update()
{
if (_alreadyCalled) return;
if (Time.timeSinceLevelLoad < 3f) return;
_alreadyCalled = true;
NetworkManager.Singleton.SceneManager.LoadScene(SceneManager.GetActiveScene().name, LoadSceneMode.Single);
}
}
TestCrash is some code that
- starts a local server
- spawns the prefab
- waits 3 seconds
- reloads the scene
Actual Outcome
After a few attempts, the scene never reloads and the Unity editor hangs forever (has to be force quitted)
Expected Outcome
The scene reloads every 3s
Environment
- OS: Windows 11
- Unity Version: 6000.4.7f1
- Netcode Version: 2.12.0
Additional Context
- This bug did not happen with 2.12.0 and Unity 6000.3.11f1 (started happening after upgrading to 6000.4.7f1)
- The bug doesn't happen without
destroyWithScene: true, - Removing the SpriteResolver/SpriteLibrary stops the bug from happening
- The NetworkObject must be spawned with
InstantiateAndSpawn, if the prefab is added to the scene, the bug doesn't happen
Here is a dump of the Main Thread stack when the editor is hanging. The CPU is at 0% at that point. Maybe a lock contention?
<unknown> 0x00007ff973d63cb4
<unknown> 0x00007ff973c30543
<unknown> 0x00007ff97107e558
UnityClassic::Baselib_SystemFutex_Wait(int * __ptr64,int,unsigned int) 0x00007ff8886af7f6
ProfilerMutexLock(Mutex & __ptr64,char const * __ptr64,profiling::Marker & __ptr64,char const * __ptr64,int) 0x00007ff88b1a4450
PersistentManager::Lock(PersistentManager::LockFlags,profiling::Marker * __ptr64) __ptr64 0x00007ff88b1a1b83
PersistentManager::GetPathName(EntityId) __ptr64 0x00007ff88b1968bb
GetGUIDFromEntityId(EntityId) 0x00007ff888e786fe
AssetChangedNotifier::UnsubscribeFromAll(EntityId) __ptr64 0x00007ff88a209aee
SpriteRenderer::MainThreadCleanup(void) __ptr64 0x00007ff88b631e42
delete_object_internal_step1(Object * __ptr64) 0x00007ff88b8cd380
CommitBatchDelete(BatchDelete & __ptr64) 0x00007ff88b5286d2
DestroyObjectHighLevel_Internal(Object * __ptr64,bool) 0x00007ff88b532e31
DestroyObjectHighLevel(Object * __ptr64,bool) 0x00007ff88b532ba8
DelayedDestroyCallback(Object * __ptr64,void * __ptr64) 0x00007ff88b7963cb
DelayedCallManager::Update(int) __ptr64 0x00007ff88b797ac8
<unknown> 0x00007ff88b4f9d6b
ExecutePlayerLoop(NativePlayerLoopSystem * __ptr64) 0x00007ff88b517f5b
ExecutePlayerLoop(NativePlayerLoopSystem * __ptr64) 0x00007ff88b51811a
PlayerLoop(void) 0x00007ff88b51d105
EditorPlayerLoop::Execute(void) __ptr64 0x00007ff889ab957a
PlayerLoopController::InternalUpdateScene(bool,bool) __ptr64 0x00007ff889ab2a9c
PlayerLoopController::UpdateSceneIfNeededFromMainLoop(void) __ptr64 0x00007ff889ab4dad
Application::TickTimer(void) __ptr64 0x00007ff889acc4c3
<unknown> 0x00007ff8894bfb2c
UnityMain 0x00007ff8894c8693
<unknown> 0x00007ff6ae972f2a
<unknown> 0x00007ff97360e957
<unknown> 0x00007ff973caad6c
- Ngôn ngữ chính
- C#
- Star
- 2.3k
- Fork
- 461
- Merge trung bình
- 3 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 20
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Unity-Technologies/com.unity.netcode.gameobjects
-
stat:import type:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
-
stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 5 bình luận · 1 người được giao ·
-
Tracking type:feature-2.x
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 bình luận ·
-
Please error, or at least warn, when a managed type is included in INetworkSerializeByMemcpy Đang mởTracking type:feature
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 bình luận ·
-
stat:awaiting-response stat:imported type:bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Unity-Technologies/com.unity.netcode.gameobjects#3802 · 2 bình luận ·
Tất cả issue của Unity-Technologies/com.unity.netcode.gameobjects
Issue tương tự
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
azurenoops/spin_agent#975 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SubtitleEdit/subtitleedit#15108 · 1 bình luận ·