question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Easy Legacy uGUI Canvas Raycast Camera updater

See original GitHub issue

Overview

Provide an easy way to update the default canvas raycasting camera for projects using uGUI. New users are not affected, because we’re already prompting them when they create new canvases.

Currently the only easy way to do this is by using the scene configuration menu and re-adding the InputManager.

More advanced users can also manually call the update using FocusManager.Instance.UpdateCanvasEventSystems();

Expected Behavior

When devs open legacy projects, we should prompt them once if they wish to update their canvases default raycasting camera if the canvas’ render mode is set to world space.

Actual Behavior

Currently older projects are automatically opted out to using the new UIRaycastCamera as the default raycaster, and devs need to manually assign the camera to each canvas who’s render mode is set to world space.

Unity Editor Version

Any/All

Mixed Reality Toolkit Release Version

405bb16be62b5d1eb18f8e5f39d9d1fe9a962013

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Streptocommented, Dec 8, 2017

But I cannot add the UI Raycast Camera to the Unity Canvas, because I do not have a Input Manager (Which contains the Raycast Camera) in my “work-scene”. The Input Manager Prefab is marked as DontDestroyOnLoad in my “Startup scene”, and is thus removed from my Work-Scene for serialization. I still believe this is relevant to this discussion.

image

I like the solution you made for Raycasting Unity UI from multiple locations. But it has (in combination with the Singleton change) created issues when trying to update our (multi-scene) projects to the latest version of the MR-Toolkit. And i’m trying to to figure out how we should proceed.

Sorry if i’m still wrong here, but I still can’t see how I should do this correctly.

Edit: Tried to make myself a bit more understandable.

1reaction
genereddickcommented, Dec 8, 2017

I think the issue is in remembering to add a new script in each new scene to call

 FocusManager.Instance.UpdateCanvasEventSystems()

Ideally this script would live on the Camera object. It could have a delegate to

SceneManager.sceneLoaded

And thus would be responsible for rewiring the connection itself. At a minimum, the documentation could use a section calling out changes required for multi-scene projects.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Touch to Ray on Canvas - Questions & Answers
I'm using some simple code to see if I'm tapping on an object using Camera.main.ScreenPointToRay. This has always worked in the past for...
Read more >
Rays from the Camera
The most common use of a Ray from the camera is to perform a raycast out into the ... public Camera camera; void...
Read more >
Gizmo issue in multi-canvas scene - Questions
My naive interpretation of the issue: It seems as if raycast for picking mesh for gizmo is based on one camera, and raycast...
Read more >
Unity UI button not reacting to clicks or hovering
I have already ensured that my Image component has "Raycast target" checked and that my Button component has "Interactable" checked. Could this ...
Read more >
Performance recommendations for Unity - Mixed Reality
Learn Unity-specific tips to improve performance with project settings, profiling, memory management in your mixed reality apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found