win game & loos game
there is a simple GameManager script given below where I have two methods LevelWon and LevelLost.
Basically, after LevelWon is called "you won" scene is showing. and if the LevelLost is called then "you lost" scene is showing.
my problem is that when the player is winning the game and "you won" scene is showing after a second "you lost" scene is popping up as well. the reason for this is that in my level lost script I am saying if player is on the ground then the level is lost. however, after winning level player goes automatically on the ground so the game lost method is called automatically. .
how can I solve that problem? is there any way which can say basically is method LevelWon is called then do not call LevelLost in any circumstances? or anything like that. Thanks for your help.
code is given below:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class GameManager : MonoBehaviour
{ public GameObject levelwon; public GameObject levelLost;
public void LevelWon()
{ levelwon.SetActive(true); Debug.Log("game Won");
}
public void LevelLost()
{
levelLost.SetActive(true);
Debug.Log("level los12t ");
}
}
Your answer
Follow this Question
Related Questions
gameObject reappearing after setactive false 1 Answer
How can I detect if a user is looking at a Gameobject inside a scene from a VR headset 0 Answers
Making a Deckbuilder 0 Answers
Object not visible in Scene tab until double click it on the Hierarchy. 1 Answer
Help me! Create a game object falling from the top scene at click mouse point! T________T 0 Answers