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
- Fixing Message Loss in UMPE During Domain Reload
- The Editor freezes when ScheduleReadOnly of IJobParallelForTransform with dependency is used
- Text is truncated in the Inspector when the display scale is set to 150%
- CancellationTokenSource(<timeout>) has incorrect cancellation status when used in WebGL Player
- VFX property value names are cut off when properties with 'Arc' are viewed in the VFX Blackboard
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.