hello unity users:)
I need some help in my SavePoint script. Like FF7 savePoints.
Need help on how to save the correct player position ,rotation and currect level, and load from main menu.
I have my script GUIsetUp and ready so far.Attach to an box whit trigger active in the scene.
#pragma strict
//Button Action control
var ButtonEsquerdaDireita : float = 80; //Control Left and right bar position. (default 80)
var ButtonCimaBaixo : float = 150; //Control Up and down bar position. (default 150)
var ButtonLarguraVertical : float = 70; //Control vertical width. (default 70)
var ButtonLarguraOrizontal : float = 70; //Control horizontal width. (default 70)
//******** Activate/Deativate Save and Load actions.***********************
private var Save : boolean = false;
private var Load : boolean = false;
//******** show String INFO Text.******************************************
var Object_INFO : String = "Saved";
var Object_INFOTwo : String = "Loaded";
//******** Save and Load Boolean information activator.********************
private var isSaved : boolean = false;
private var isLoaded : boolean = false;
function OnGUI()
{
//************** Show and hide,saving and loading information text.****
if (isSaved)
{
GUI.TextArea (Rect (10, 10, 100, 100), Object_INFO, 50);
isLoaded = false;
}
if (isLoaded)
{
GUI.TextArea (Rect (10, 10, 100, 100), Object_INFOTwo, 50);
isSaved = false;
}
//********************************END***********************************
//************** Save and Load functions.*****************************
if (Save)
{
GUI.backgroundColor = Color.green;
if(GUI.Button(new Rect(20,120,80,20), "Save"))
{
isSaved = true;
isLoaded = false;
//need here save function......
}
}
if (Load)
{
GUI.backgroundColor = Color.green;
if(GUI.Button(new Rect(20,150,80,20), "Load"))
{
isLoaded = true;
isSaved = false;
//need here load function.....
}
}
//*********************************END***********************************
}
//****************** Trigger,actions activator*******************************
function OnTriggerEnter(hit : Collider)
{
Save = true;
Load = true;
}
function OnTriggerExit()
{
Save = false;
Load = false;
isSaved = false;
isLoaded = false;
}
//*************************************END***********************************