-
Notifications
You must be signed in to change notification settings - Fork 93
Editor: Skip CesiumIonSession.Tick() when Unity is offline #575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Problem ------- If the Unity Editor launches without an Internet connection, CesiumIonServerManager.instance.currentSession.Tick() throws every frame because the DNS lookup for https://api.cesium.com fails. The result is an endless stream of red-error messages: Exception: Request for `https://api.cesium.com/appData` failed: Cannot resolve destination host Exception: Failed to obtain _appData, can't resume connection The spam clutters the Console and can even interrupt later domain reloads. Change ------ Added a single guard clause at the top of Editor/CesiumEditorUtility.UpdateIonSession(): if (Application.internetReachability == NetworkReachability.NotReachable) return; When Unity reports that the machine is offline the function now returns immediately, so the session is ticked again only after connectivity is restored.
Thanks for the PR @Heisenberk-Karabay! Could you please sign a Contributor License Agreement (CLA) for us? We need this before we can take a look at your PR's contents. Thanks! |
Hello, signed it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @Heisenberk-Karabay!
I confirmed that this prevents the Failed to connect...
logs from appearing in the Console, though it does not enable the tileset to appear in Play Mode. Is that expected for this PR?
I'm also not sure if the Application.internetReachability
check is sufficient for all offline scenarios. The Unity docs say:
Do not use this property to determine the actual connectivity. For example, the device can be connected to a hot spot, but not have the actual route to the network.
Still, the check is an improvement overall, and is something that we should consider putting in the Editor code anyway.
No, that is not the intended behavior. The PR allowed me to see the tileset in Play mode. I’ll try to reproduce the issue with a fresh install. I’ll also look into the matter regarding |
@Heisenberk-Karabay Feel free to keep things going on this PR! Thanks for the quick response 🙏 |
Hello, I’ve tested it and recorded a video of the process. The tileset loads completely offline without any errors. I also included the Windows taskbar in the recording to confirm that there was no internet connection. PR.575_test.mp4 |
comprehensive network-reachability check
Updated the code to do network checks as referenced in: https://docs.unity3d.com/6000.1/Documentation/ScriptReference/NetworkReachability.html |
Sorry for the mistake @Heisenberk-Karabay, it turned out to be something on my side while testing. Thanks for incorporating the feedback! Can I trouble you to update CHANGES.md for this fix? Once the changelog has been updated, I'm happy to merge. |
No worries. I'm not sure which part of the |
@Heisenberk-Karabay you can put it under a new version! We usually just leave it as Also, sorry to double-back -- but a colleague just pointed out to me that we need to test this out with Cesium ion self-hosted (which is supposed to work on self-contained / offline networks). I need to hold off on the merge until we try this out 😬 |
No problem at all! I'll be eagerly waiting for the results of the tests. In the meantime, I'll go ahead and update the |
I've updated the |
@j9liu how are you testing this? I tried it out by putting my system in airplane mode shortly after launching Unity (I can't do it beforehand, because then I won't be able to check out the network license). When I do this, I do see the two errors in the top post, but each is only reported once. It's not clear to me what would cause those messages to be spammed repeatedly. |
I think the issue was on my side—I reported it a bit inaccurately. The error messages only show up once. |
I tested this in the same way -- once I see Unity start up after it's verified our licenses, I disconnect myself from the internet. However, I was only seeing the |
Problem
If the Unity Editor launches without an Internet connection, CesiumIonServerManager.instance.currentSession.Tick() throws every frame because the DNS lookup for https://api.cesium.com fails. The result is an endless stream of red-error messages:
The spam clutters the Console and can even interrupt later domain reloads.
Change
Added a single guard clause at the top of
Editor/CesiumEditorUtility.UpdateIonSession():
When Unity reports that the machine is offline the function now returns immediately, so the session is ticked again only after connectivity is restored.