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
-
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
- Lights with Cookies generate Cookie Atlas and increase Memory usage every time when Play mode is entered
- Crash on mono_traverse_object_internal when exiting Play mode on a specific project
- Camera prefab shows up in overrides after upgrade when game view is changed to Simulator
- Prefab Override context menu does not appear when changing attributes on a Terrain Component
- Particles are visible through Mesh when Sprite-Lit-Default Material is used
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.