- Home /
Is it possible hide a complete scene or make it invisible? (Scripting)
Hi all, i'm new in Unity and programming but i do my very best :)
atm i' m hard working on a game-project and i have a little problem with my menu (and google dont want to help me :D)...
I'm using...
if(GUI.Button(Rect(200,50,45,45),"+")){
Application.LoadLevelAdditive (2);
}
because i need the script and gameobjects of the old scene (different types of menuscreens like: character selection -> charcreation (choose race --> choose class)) and it works... but i want just to see the new scene and want to have the old scene on invisible. Is there a possibility to make the whole old scene invisible?
(here explaination in paint :D)
Answer by LightSource · Mar 08, 2013 at 10:17 PM
You can use gameObject.active"
For example:
var yourObject : Gameoject;
var clicked = false;
function Update () {
if (clicked == true) {
yourObject.active = false;
}
else {
yourObject.active = true;
}
}
What this does is if you assign the variable in the inspector (your game object), when clicked is true, your object will be turned off. It is is the equivalent of clicking the button at the top of your object in the inspector. If you need clarification, please ask.
Your answer
Follow this Question
Related Questions
Placing a gameObject into, and pulling out of inventory 2 Answers
Invisible effect? 3 Answers
Is there another way to hide an object 2 Answers
Renderer on object disabled after level reload 1 Answer
Hiding parts of a mesh 1 Answer