Search Issue Tracker
By Design
Votes
3
Found in
2019.1.1f1
Issue ID
1154445
Regression
No
[Prefab] Environment canvas remains referenced as main canvas despite adding a canvas component to a prefab
To reproduce:
1. Open attached project "CanvasRootRepro.zip"
2. In Project window, select Child prefab and unparent it from RootCanvas, so the prefab no longer has no canvas
3. In Inspector window, select Child prefab and open it in Prefab mode - Environment Canvas is placed (intended)
4. Add a Canvas component on Child game object (doesn't matter if it's done in prefab mode or not)
5. In Prefab mode, observe the prefab's hierarchy
Expected: environment canvas is no longer referenced as there's canvas component present
Actual: environment canvas still being used as main canvas, despite prefab having it's own canvas
Reproduced in: 2018.4.1f1, 2019.1.4f1, 2019.2.0b3, 2019.3.0a3
Note: not checked on 2017.4 LTS due to prefab workflow not being implemented
Comments (2)
-
hadesfury
Nov 08, 2021 07:34
It seems that for you canvas to be seen as a "root" canvas, you need to keep the rect transform value as default, it means "anchor preset" to "bottom left" and all values to "0"
-
Yishar
Apr 22, 2020 09:27
It happens even if you add an empty scene to the UI Prefab Environment in editor settings, it still creates a default canvas over the prefab's canvas
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- ACES Tonemapping causes banding artifacts and negative values in ColorGradingLUT when HDR is enabled and "High Dynamic Range" Grading mode is selected while Android Platform is used
- Android Player freezes when an Audio Source is playing and an incoming call is picked up and then hung up and the Audio Source is started again
- Green success icon is poorly visible in the light Unity theme
- Incorrect input into the Input Field when using Microsoft IME Japanese
- Multiplayer role "ClientAndServer" is displayed without the spaces in the "Play Mode Scenarios" window
Resolution Note:
Canvases are not always root canvases; there can be nested canvases too. Unfortunately we can't see when we open a Prefab Asset with a World Space canvas on it if it was intended as a root World Space canvas or as a nested Canvas - the serialized data doesn't have any information about this. For safety we have to assume it's a nested Canvas, since the downsides of treating a nested Canvas as if it's a root Canvas are greater. It's still possible to change the Canvas properties by selecting the Prefab in the Project view and changing the Canvas properties in the Inspector.