Home Game Development unity – DivideByZeroException is barely thrown in Mono builds, not in IL2CPP. Why?

unity – DivideByZeroException is barely thrown in Mono builds, not in IL2CPP. Why?

0
unity – DivideByZeroException is barely thrown in Mono builds, not in IL2CPP. Why?

[ad_1]

I’m engaged on exception dealing with and I normally check it with inflicting a DivideByZeroException.

But this time it is not thrown. (While throwing a System.Exception works similar to common).

So I’ve created an empty undertaking with solely this script:

void Update()
{
    if (Input.GetKeyDown(KeyCode.L))
    {
        Debug.Log("L");
        var x = 0;
        var y = 1 / x;
    }
    if (Input.GetKeyDown(KeyCode.P))
    {
        Debug.Log("P");
        throw new System.Exception("check");
    }
}

And with the empty undertaking the DivideByZeroException is thrown, so I had a glance on the undertaking configurations.

Turns out the brand new undertaking’s Scripting Backend is Mono.

Once I modified it from Mono to IL2CPP, the DivideByZeroException isn’t thrown on this undertaking as nicely.

enter image description here

I experimented with altering the API Compability Level, however they behave the identical.

enter image description here

So final time I debugged exception dealing with, I used to be on Mono after which I modified it … I assume to make it quicker or one thing.

My query is: why is that this the case?

[ad_2]

LEAVE A REPLY

Please enter your comment!
Please enter your name here