Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.2K
Visualizações
Unity: Application keeps running in background although Application.runInBackground is false

I'm currently developing some Unity project(this is my first one, I'm not familiar with Unity) and what bothers me is that breakpoints are still hitting when I minimize Unity editor window although I have Application.runInBackground == false so the app should be suspended while in background, but it is not ! Only the UI gets frozen and music stops while the actual code is continue executing. So, I'm basically wondering if this is general behaviour or this only happens when you're running in editor to allow debugging and in release builds code execution stops ?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I had similar issues. I found that it is because I have an IDE attached to Unity and only then did this happen. When you switch to release mode, everything go as it's supposed to - debug mode in Unity.

over 4 years ago · Santiago Trujillo Relatório

0

Did you try changing it in the editor? go to Edit -> Project Settings -> Player. The inspector pane will now change to show the player settings. Look for the option that says "Run In Background" and uncheck it. From what I understand Application.runInBackground == false more of pauses it than stops the script from running. If your project is for mobile(or maybe just add this anyway, it might help),try:

RuninBackgorund is ignored for Android and IOS how you can see here

The only and efficient way to run in background on Android is through a Service. You can use OnApplicationPause method to get notified when the game pauses/unpauses.

public void OnApplicationPause(bool paused) {
if(paused) {
// Game is paused, stop service notifications.
} else {
// Game is unpaused, start service to get notifications
}

Here you have a nice tutorial about communication between android and unity

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda