Search Issue Tracker
Fixed
Fixed in 2021.3.34f1, 2022.3.16f1, 2023.2.3f1, 2023.3.0a13
Votes
2
Found in
2021.3.28f1
2022.3.4f1
2023.1.4f1
2023.2.0a23
Issue ID
UUM-42366
Regression
No
Editor crashes on Camera::GetCameraRect when calling renderingDisplaySize on a nested Canvas GameObject
How to reproduce:
1. Open the “IN-46239_NestedCanvas_repro.zip“ project
2. Open the “SampleScene“
3. Select the “Canvas2“ GameObject
4. Right-click on the Test.cs component and select “Crash Unity“
Expected result: Editor continues to run
Actual result: Editor crashes
Reproducible with: 2021.3.28f1, 2022.3.4f1, 2023.1.4f1, 2023.2.0a23
Reproducible on: Windows 10
First few lines of the Stack Trace:
0x00007ff7253f5bcf (Unity) Camera::GetCameraRect
0x00007ff72607ad19 (Unity) UI::Canvas::GetRenderingDisplaySize
0x00007ff724d79e07 (Unity) Canvas_CUSTOM_get_renderingDisplaySize_Injected
0x000001d47608009c (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Canvas:get_renderingDisplaySize_Injected (UnityEngine.Canvas,UnityEngine.Vector2&)
0x000001d47605fe63 (Mono JIT Code) UnityEngine.Canvas:get_renderingDisplaySize ()
Comments (1)
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
- [Linux] Player window unexpectedly resizes to monitor dimensions when calling "Screen.SetResolution" function with hardcoded resolution matching current display's width or height
- Color picker does not show the correct color when selecting color on the moving object
- “Asset X has no meta file, but it's in an immutable folder. The asset will be ignored.” errors are thrown when importing package with files not listed in package.json's "files" property
- There is no way to adjust the HDR Paper White value of the Unity Editor's interface, making it difficult/uncomfortable for some developers to work on very dark/bright scenes in HDR
- Animator window has a dropdown button that throws “MissingReferenceException” error on a new project when the previous project had a GameObject with an animation
JohannesDemlInnoGames
Jul 20, 2023 05:28
You can reproduce the issue by creating a new canvas and trying to access the render size right away:
```
public static void GetCanvasDisplaySizeCrash()
{
GameObject gameObject = new GameObject("TestCanvas");
var canvas = gameObject.AddComponent<Canvas>();
var renderingDisplaySize = canvas.renderingDisplaySize;
Debug.Log($"x: {renderingDisplaySize.x}, y: {renderingDisplaySize.y}");
}
```