Skip to content

fix: hot-reload broken VCam apply retry #4315

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

Merged
merged 9 commits into from
Jun 5, 2025
Merged

Conversation

pravusjif
Copy link
Member

@pravusjif pravusjif commented May 31, 2025

WHY

I encountered these 3 bugs that affect creators dev-exp + unity devs dev-exp:

  1. [Cannot reproduce anymore...] Since recently, during the hot-reload of a local scene, Unity may crash randomly while the scene reloads.
  2. [Cannot reproduce anymore...] Since recently, during hot-reload of a local scene, Unity may end up throwing ObjectDisposedException infinitely
  3. I detected that if a scene uses a VCam from the beginning, it works OK the first load but after hot-reloading many many times the VCam is never re-assigned correctly at the beginning of the scene.

Virtual Camera breaking after hot-reload (3.) demo (second 0:11)

Screen.Recording.2025-06-02.at.1.24.20.PM.mp4

WHAT

  1. Fixed Unity Editor crash when hot-reloading a scene by placing the Resources.UnloadUnusedAssets(); call during LSD to be called AFTER we waited for the scene to reload. I guess that maybe some unused assets may be getting re-used during the WaitUntilNewSceneIsFullyLoadedAsync() and that may be why it exploded there.
  2. Fixed the ObjectDisposedException infinite throwing observed during hot-reload by adding a check to know if the token is able to be Cancelled.
  3. Fixed the Virtual Camera application being broken after hot-reload on scenes that use the VCam since the beginning, by making sure that the MainCameraSystem retries when the target CRDT Entity didn't have the PBVirtualCamera component yet.

TEST INTSTRUCTIONS

  1. Download this test scene
  2. Enter the scene root folder and run npm i and then npm run start -- --explorer-alpha
  3. Close the Explorer that auto-opened. Leave the scene running in the console/terminal.
  4. Download the build from this PR and connect it to the running scene using the console command according to your OS
  5. Once the scene loads, confirm that the camera of that scene is a TOP DOWN camera (not any of the normal character cameras)
  6. Leave the Explorer running and in any text editor open index.ts file of the scene that you have running (ideally in a different monitor)
  7. Modify the const CHANGE_THIS_VALUE_FOR_HOT_RELOAD = 1 (that's in the index.ts file) value to any different number to trigger a hot-reload of the scene in the Explorer -> Confirm that the scene has been automatically reloaded (hot-reload) and that the Camera is again put as a TOP DOWN camera.
  8. Repeat step 7 for another 9 times to confirm that the virtual camera always works as expected after a hot-reload.

@pravusjif pravusjif self-assigned this May 31, 2025
@pravusjif pravusjif added the bug Something isn't working label May 31, 2025
Copy link
Contributor

github-actions bot commented May 31, 2025

@pravusjif pravusjif moved this from Todo to In Progress in Creators Tools Jun 2, 2025
@pravusjif pravusjif moved this from Todo to In Progress in Explorer Alpha Jun 2, 2025
@pravusjif pravusjif marked this pull request as ready for review June 2, 2025 11:52
@pravusjif pravusjif requested review from a team as code owners June 2, 2025 11:52
@pravusjif pravusjif removed the request for review from AnsisMalins June 2, 2025 11:52
@pravusjif pravusjif moved this from In Progress to QA in Creators Tools Jun 2, 2025
@pravusjif pravusjif moved this from In Progress to With QA / Awaiting Review in Explorer Alpha Jun 2, 2025
@pravusjif pravusjif requested review from DafGreco and removed request for Ludmilafantaniella June 2, 2025 11:54
Copy link

@DafGreco DafGreco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️ PR reviewed and approved by QA on both platforms following instructions playing both happy and un-happy path

Regressions for this ticket had been performed in order to verify that the normal flow is working as expected:

  • [✔️ ] Backpack and wearables in world
  • [✔️] Emotes in world and in backpack
  • [✔️ ] Teleport with map/coordinates/Jump In
  • [✔️ ] Profile card
  • [✔️ ] Camera
  • [ ✔️] Skybox
  • [✔️ ] Settings

@pravusjif pravusjif requested review from fcolarich and removed request for dalkia June 3, 2025 13:16
@pravusjif pravusjif changed the title fix: hot-reload exceptions + broken VCam apply retry fix: hot-reload broken VCam apply retry Jun 4, 2025
@pravusjif pravusjif requested a review from dalkia June 4, 2025 23:20
@github-project-automation github-project-automation bot moved this from With QA / Awaiting Review to In Progress in Explorer Alpha Jun 5, 2025
@pravusjif pravusjif merged commit 51e28f2 into dev Jun 5, 2025
7 of 8 checks passed
@pravusjif pravusjif deleted the fix/2-exceptions-1-vcam branch June 5, 2025 10:25
@github-project-automation github-project-automation bot moved this from In Progress to Done in Explorer Alpha Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: QA
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants