scene/gameobject wont deactivate after trigger
Hello guys, im having trouble deactivating a gameobject/scene when my player triggers an enemy encounter. It goes into the battle scene but, you cant see it because the previous scene is still visible.
here is the code im trying to use
void OnTriggerEnter2D(Collider2D others)
{
if (others.gameObject.CompareTag("Player"))
{
deactivateScene.SetActive(false);
SceneManager.LoadScene(8, LoadSceneMode.Additive);
}
}
im using additive because i dont want my previous scene get destroyed.
Imagine playing pokemon. Had an encounter, but you cant see the battle. only your player in the grass.
in addition, I would also like some help on how to reactivate said scene.
Answer by xuanyuan · Jul 30, 2018 at 01:30 PM
You can define a layer for invisible that main camera not render. so can set previous scene layers to it. Then you quit battle, set layer back.
Your answer
Follow this Question
Related Questions
Trying to get bool statement to work in OnTriggerStay2D 1 Answer
Issues with dropping an object on multiple objects separetly - Simple 2d Drag & Drop 0 Answers
DontDestroyOnLoad not working properly on build (i think thats the problem atleast) 0 Answers
I can't do jump in my 2D game 1 Answer
Why do I keep getting a null reference? Its not null! 0 Answers