Skip to content
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

EnsureCameraRig in editor constantly recreates the CameraRig #49

Open
SimonDarksideJ opened this issue Sep 3, 2022 · 0 comments
Open
Labels
bug Something isn't working

Comments

@SimonDarksideJ
Copy link
Contributor

Reality Collective - Reality Toolkit Bug Report

Describe the bug

There is a race condition but with the "EnsureCameraRig" function when it is run in the editor, the reason being that the "ServiceFramework.Initialise" method is executed on the background thread.

However, this requires a query to the active scene which is only possible on the UI thread, so when it queries for CameraCache.Main, it always returns a brand new Camera (because Unity....)

The Log to state it has been recreated is currently omitted in the log for the editor to prevent confusion.
https://github.com/realitycollective/com.realitytoolkit.core/blob/108eeb76c7cb801bbe210eb9dca8e7bfdc5b098f/Runtime/CameraSystem/Providers/BaseCameraDataProvider.cs#L283

To Reproduce

  1. Configure a scene for the Service Framework
  2. Expand any configuration in the Service Framework configuration
  3. The above code is run, even though an XRCameraRig does in fact exist in the active scene
  4. Don't see error when #if clause is left in

Expected behavior

If the Camera code runs on teh UI thready, the issue should not occur

Actual behavior

Because the code is executed on the background thread, the XRCameraRig is always recreated.

@SimonDarksideJ SimonDarksideJ added the bug Something isn't working label Sep 3, 2022
SimonDarksideJ added a commit to realitycollective/com.realitytoolkit.core that referenced this issue Sep 3, 2022
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
None yet
Development

No branches or pull requests

1 participant