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

349
Visualizações
Making a loading screen when player collides (doesnt work)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;


public class LevelLoader : MonoBehaviour
{
void OnCollisionEnter(Collision col)
  {
    if (col.gameObject.tag == "Player");
    {
      StartCoroutine(LoadAsynchronously(1));
    }
  }

    IEnumerator LoadAsynchronously (int sceneIndex)
    {
       AsyncOperation operation = SceneManager.LoadSceneAsync(1);

       while (!operation.isDone)
       {
          yield return null;
       }
    }
}

I tried changing some things but it's not working anyways if someone can help me. is supposed to work when collides with that object but IDK why nothing happens

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

0

Try to make a bool flag for it

bool loadScene = false;

void OnCollisionEnter(Collision col)
  {
    if (col.gameObject.tag == "Player");
    {
      if(!loadScene){
      StartCoroutine(LoadAsynchronously(1));
      loadScene = true;
      }
    }
  }
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