Release Mode in Editor

Hi there,

in theory I like the feature that you can choose between using DEBUG- or RELEASE-mode in the Editor.
But, I would expect in the case that RELEASE-Mode is chosen:

  1. that the DEBUG-Define is unset and RELEASE-Define is set.
  2. Asserts being ignored.

Both is not the case. Is that a bug or is there some sense behind it?
Looking at the Assert-Class source shows that those calls are tagged with conditional-attribute on ‘UNITY_ASSERTIONS’-Define. So this should also be unset.

Greets, Tom

It’s not really clear but that setting is only for the code optimization level. If you read through the documentation, you can see hints of that here and there. I.e. it only affects wether code optimization is set to release (faster code but cannot connect debugger) or debug (slower but can connect debugger). It does not affect compilation defines or other settings. Besides the optimization level, the editor is always running in debug mode and this cannot be changed (see here ).

2 Likes

In theory… But what is your actual usecase? What do you expect to be different? When you run your game in the editor, you do that to debug / test it. So what is the usecase of running the game in release mode inside Unity? You can’t evaluate performance properly since the editor is still there and there will always be a slight overhead. If you want to test release performance, build the game.

@Bunny83
Bunny, my usecase was that I wanted to run our game in the editor with ‘asserts’ being disabled and I thought that I could achieve this by using that ‘release mode’ option. A special occasion that we usually will never need but today we did. It was not for performance testing as you assumed, just to stop one occasional assert to kick us in the wrong moment. (In the end we used ‘UnityEngine.Assertions.Assert.raiseExceptions’ )

@Adrian Thanks for you reply. Reading the first link (again) I understand now that the ‘Code Optimization on Startup’ option is about the editor’s dotnet-runtime itself (explains the ‘strange’ name). I falsely assumed it was about the game. But it makes sense. Since since both (Editor and Game) share the same runtime the only option to let the game run in ‘release-mode’ is to set the editor’s runtime to release-mode.
That means the stuff the dude in the second link(“The editor is always in debug-mode”) is not true anymore(comment was from 2016). So when the editor is already in release-mode why not compile the whole project to release (with all expected effects)?!? But in the end I’m ok with it, I was just confused because I thought it would compile the project to release.

Thx a lot