these scripts i use for spawning in a character but when i spawn in that character it spawns not where i want it to spawn (0,3,0) is the spawn location when it switches levels.
i need it to be (146.8811,87.60048,1877.452) but i cant figure out how…
#pragma strict
var char1 : GameObject;
var char2 : GameObject;
var char3 : GameObject;
var charDescription = “Release the Magic within with the mage.”;
var char1Name = “Mage”;
var char2Name = “Warrior”;
var char3Name = “Theif”;
static var char1Bool : boolean = true;
static var char2Bool : boolean = false;
static var char3Bool : boolean = false;
function Start () {
char1.transform.position = Vector3(0,3,0);
char2.transform.position = Vector3(-15,3,0);
char3.transform.position = Vector3(-30,3,0);
}
function OnGUI() {
GUI.Box (Rect(Screen.width / 2 - 175, Screen.height / 2 - 300, 350, 350), “Select your Character.”);
if(GUI.Button (Rect(Screen.width / 2 - 60, Screen.height / 2 - 60, 125, 50), "SELECT")) {
if(char1Bool == true) {
PlayerPrefs.SetInt("Character", 1);
Debug.Log(PlayerPrefs.GetInt("Character"));
}
Application.LoadLevel("New Life");
}
//------------------------------------------------------------------------------------------------------------------------------------------
if(char1Bool == true) {
charDescription = “Release the Magic within with the mage.”;
GUI.Box (Rect(Screen.width / 2 - 300, Screen.height / 2 - 100, 125, 75), char1Name);
GUI.Label (Rect(Screen.width / 2 - 300, Screen.height / 2 - 85, 100, 75), charDescription);
}
if(char2Bool == true) {
charDescription = "The Brave. The Strong. The WARRIOR.";
GUI.Box (Rect(Screen.width / 2 - 300, Screen.height / 2 - 100, 125, 75), char2Name);
GUI.Label (Rect(Screen.width / 2 - 300, Screen.height / 2 - 85, 100, 75), charDescription);
}
if(char3Bool == true) {
charDescription = "Fast, Sneaky, Quick, the thief...";
GUI.Box (Rect(Screen.width / 2 - 300, Screen.height / 2 - 100, 125, 75), char3Name);
GUI.Label (Rect(Screen.width / 2 - 300, Screen.height / 2 - 85, 100, 75), charDescription);
}
if(GUI.Button(Rect( Screen.width / 2 - 225, Screen.height / 2 -150, 50, 50), "<")) {
if(char1Bool == true) {
char1Bool = false;
char2Bool = true;
char3Bool = false;
char1.transform.position = Vector3(15,3,0);
char2.transform.position = Vector3(0,3,0);
char3.transform.position = Vector3(-15,3,0);
}else {
if(char1Bool == false) {
if(char2Bool == true) {
char1Bool = false;
char2Bool = false;
char3Bool = true;
char1.transform.position = Vector3(15,3,0);
char2.transform.position = Vector3(15,3,0);
char3.transform.position = Vector3(0,3,0);
}
}
}
}
if(GUI.Button(Rect( Screen.width / 2 + 175, Screen.height / 2 - 150, 50, 50), ">")) {
if(char3Bool == true) {
char1Bool = false;
char2Bool = true;
char3Bool = false;
char1.transform.position = Vector3(15,3,0);
char2.transform.position = Vector3(0,3,0);
char3.transform.position = Vector3(-15,3,0);
}else {
if(char3Bool == false) {
if(char2Bool == true) {
char1Bool = true;
char2Bool = false;
char3Bool = false;
char1.transform.position = Vector3(0,3,0);
char2.transform.position = Vector3(15,3,0);
char3.transform.position = Vector3(15,3,0);
}
}
}
}
}