Skip to content

Commit ec4d1c8

Browse files
committed
fix(unity_manager): increase timeout and check unity connection
Increase timeout duration from 1 to 3 seconds for event receiver and add connection check when timeout occurs to handle potential Unity Editor crashes
1 parent 80bb6e2 commit ec4d1c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/unity_manager.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ impl UnityManager {
622622

623623
// Wait for refresh response first
624624
while start_time.elapsed() < timeout_duration && !refresh_task.is_completed() {
625-
match timeout(Duration::from_secs(1), event_receiver.recv()).await {
625+
match timeout(Duration::from_secs(3), event_receiver.recv()).await {
626626
Ok(Ok(event)) => {
627627
match event {
628628
UnityEvent::RefreshCompleted(message) => {
@@ -661,6 +661,8 @@ impl UnityManager {
661661
return Err("Event channel closed during refresh. Hint: Unity Editor process shuts down unexpectedly, it could have crashed or been killed by user.".into());
662662
}
663663
Err(_) => {
664+
// Important: Check if Unity Editor is still running
665+
self.update_unity_connection().await;
664666
}
665667
}
666668

0 commit comments

Comments
 (0)