Search Issue Tracker

By Design



Found in


Issue ID




[WebGL] In developer build method Mathf.CeilToInt() throws an exception




Priority: 3Not yet prioritized for a release


Severity: 3Secondary functionality broken

Steps to reproduce:
1. Download project
2. Build for WebGL Developer Build
3. Open index.html in a web browser

Expected results: returns -2147483647 value
Actual results: Mathf.CeilToInt() throws an exception

Reproduced with: 2019.2.0a1, 2019.1.0a14, 2018.3.3f1
Not reproducible in: 2017.4.18f1

exception thrown: RuntimeError: integer overflow,_Mathf_CeilToInt_m0230CCC7CC9266F18125D9425C38A25D1CA4275B@blob:null/97ece9de-a606-46b9-a946-c044d7947787 line 1379 > WebAssembly.instantiate:wasm-function[33195]:0x85e16e
_TestCeil_Start_m89B55F5DD7E7290449C2F37AC1F6D50326337F47@blob:null/97ece9de-a606-46b9-a946-c044d7947787 line 1379 > WebAssembly.instantiate:wasm-function[43820]:0xa75090

Response avatar

Resolution Note:

This is not a bug. In development build, we have additional checks for undefined behaviour, like Mathf.CeilToInt(float.PositiveInfinity). C# says in "In a checked context, an OverflowException is thrown, while in an unchecked context, the result is an unspecified value of the destination type." C++ (that is generated during il2cpp) also doesn't support int overflow. To solve this please make sure you have correct input for CeilToInt first.

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.