- Home /
How can I change the canvas being viewed by my camera?
I am extremely surprised that no one has asked this. Basically, I have a scene with a 3d background and the main menu on the side. When the user hits 'Play", I want a different menu showing, the level selection menu. I have the level selection menu on another canvas. How, when the play button is clicked, can I show the level selection menu instead of the main menu (I want to do this all in one scene because I'd prefer to keep the nice 3d background)?
Answer by RobAnthem · Apr 01, 2017 at 11:48 AM
The reason you have not seen this question asked is because you are basically overthinking it. Here is an incredibly simple solution. They are just objects like any other, so they can be toggled like any other.
public GameObject Canvas1;
public GameObject Canvas2;
public void ToggleCanvases()
{
Canvas1.SetActive(!Canvas1.activeInHierarchy);
Canvas2.SetActive(!Canvas2.activeInHierarchy);
}
Your answer
Follow this Question
Related Questions
How do I create an Image of certain size in the middle of the screen with stretching border images 0 Answers
Text object can't be searched for with GameObject.Find 3 Answers
How to make button stay the same size on all screens? 2 Answers
Problem with modifying scrollPosition on android 1 Answer
Tutorials for 2D game GUI 2 Answers