I’m making a fps game and i’m trying to make a gun customization screen how would you make it so when you are done customizing you click a game object and it spawns you?
This is how you change scenes.
Go to File>Build Settings and drag your scenes in there. Note the numbers that are listed with each scene. To load them use Application.LoadLevel(0);
in a script, where 0 is the number of the scene you want to load.
For instance:
using UnityEngine;
using System.Collections;
public class GameGUI : MonoBehaviour {
void OnGUI () {
// Make a background box
GUI.Box(new Rect(10,10,100,90), "This is a GUI Box");
// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
if(GUI.Button(new Rect(20,40,80,20), "Start Game")) {
Application.LoadLevel(1);
}
}
I would highly recommend using GUI buttons , but the way to use gameobjects is with colliders
var isGameButton : boolean = false;
function OnMouseUp (){
if( isGameButton )
{
Application.LoadLevel("LevelName");
}
Tick the isGameButton and if you click on it it loads that level
make sure you have a box collider attached to it then when you click on it it should load the level - but make sure the level is also set in the Build settings if you have a problem with it tell me