Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2020.1
2020.2
2020.2.0a9
Issue ID
1253237
Regression
No
[WebGL] Javascript error is thrown when executing Func<Vector3> func = () => Vector3.zero; in build
How to reproduce:
1. Open user attached project "Bug Reproduce.zip"
2. Build and Run for WebGL
Expected result: No Error is thrown when the build starts playing
Actual result: Javascript error is thrown after the build starts playing
Reproducible with - 2018.4.25f1, 2019.4.4f1, 2020.1.0b16, 2020.2.0a18
Successfully reproduced on: Chrome, Firefox, Opera
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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
Resolution Note (2020.2.X):
A quick stand-alone test showed there was nothing wrong with `Func<Vector3> func = () => Vector3.zero;`. The reason why the given example is crashing is because the "Test" component is on an object that's a child of the camera. GameManager. GameManager gets the Test component via `Test test = Camera.main.gameObject.GetComponent<Test>();`. This is not correct, it should be returning null. I moved the Test component onto the camera, and the example worked correctly. You can set "Enable Exceptions" to "Full" in the Player Settings under Publishing Settings, to get the NullReferenceException that would have revealed the problem.