Erros nesse script?
5 participantes
Página 1 de 1
Erros nesse script?
Boa noite amigos eu consegui esse script num tutorial no youtube achei bem legal mais ele esta mostrando erros na linha 4,5,6,7 eu estou usando a Unity 5 sera que e isso ?
- Código:
/* PauseMenu.js by ThunderWire_Games * Script for Pause Game and - Save/Load Menu */
class ComponentsClass {
var BlurEffect : Blur;
var Look : MouseLook;
}
var Components : ComponentsClass = new ComponentsClass ( ) ;
var playerPosition : Transform;
var mainMenuSceneName : String;
var Skin : GUISkin;
var LoadPosition : String = "false"; //set to "true" is you want to load position or "false" to load only level
private var LoadLevel : boolean = true;
private var Look1 : MouseLook;
private var PlayerX : float;
private var PlayerY : float;
private var PlayerZ : float;
private var pauseEnabled = false;
function Start(){
PlayerPrefs.SetString("LoadPosition",LoadPosition); //set loadPosition true or false
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
LoadPlayer();
}
function SavePlayer(){
if(PlayerPrefs.GetString("LoadPosition") == "true"){ //save current position
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true"); //allow the load position
//Debug.Log("Saved to " + " X: " + PlayerPrefs.GetFloat("PlayerX") + " Y: " + PlayerPrefs.GetFloat("PlayerY") + " Z: " + PlayerPrefs.GetFloat("PlayerZ"));
}
PlayerPrefs.SetString("LevelName", Application.loadedLevelName); //save current level
}
function loadLevel(){ //load saved position
if(PlayerPrefs.GetString("LevelName") == Application.loadedLevelName){ //check if you have Loaded Level
LoadLevel = false;
}
if(LoadLevel == true){
Application.LoadLevel(PlayerPrefs.GetString("LevelName")); //load saved level
}
}
function LoadPlayer(){ //load player position on saved level
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position.x = (PlayerPrefs.GetFloat("PlayerX"));
playerPosition.transform.position.y = (PlayerPrefs.GetFloat("PlayerY"));
playerPosition.transform.position.z = (PlayerPrefs.GetFloat("PlayerZ"));
//Debug.Log("LOAD POS");
}
}
function Update(){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z); //set current player position
LoadPosition = PlayerPrefs.GetString("LoadPosition"); //check if loadPosition is true or false
//check if pause button (escape key) is pressed
if(Input.GetKeyDown("escape")){
Look1 = gameObject.GetComponent (MouseLook); //set MouseLook script
//check if game is already paused
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
Components.BlurEffect.enabled = false;
Components.Look.enabled = true;
Look1.enabled = true;
}
//else if game isn't paused, then pause it
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
Components.BlurEffect.enabled = true;
Components.Look.enabled = false;
Look1.enabled = false;
}
}
}
private var showGraphicsDropDown = false;
function OnGUI(){
GUI.skin = Skin;
if(pauseEnabled == true){
//Make a background box
GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 180,250,280), "Pause Menu");
//Make Main Menu button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(mainMenuSceneName);
}
//Make Save Game button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,50), "Save Game")){
SavePlayer();
}
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 150,250,50), "Load Game")){
loadLevel();
LoadPlayer();
}
//Make Change Graphics Quality button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
//Create the Graphics settings buttons, these won't show automatically, they will be called when
//the user clicks on the "Change Graphics Quality" Button, and then dissapear when they click
//on it again....
if(showGraphicsDropDown == true){
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
//Make quit game button
if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
Última edição por Callyde Jr em Qua Out 19, 2016 7:17 am, editado 2 vez(es)
Re: Erros nesse script?
Troque todos os "Application.LoadLevel" por SceneManager.LoadScene e veja se dá certo.
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
https://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.html
https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html
https://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.html
George Lucas Vieira- Avançado
- PONTOS : 3391
REPUTAÇÃO : 132
Idade : 21
Áreas de atuação : Programação, Modelagem e Animação.
Respeito as regras :
Re: Erros nesse script?
Peço que coloque o script corretamente. Todo post seu voce coloca 'C#' dentro de uma caixa de scripts e deixa o resto do script fora. Tira o C# e coloca todo seu script dentro de code /code
RenanMSV- Instrutor
- PONTOS : 4483
REPUTAÇÃO : 356
Áreas de atuação : Programação em C#, PHP. SQL, JavaScript (Web)
Respeito as regras :
Re: Erros nesse script?
Assim
- Código:
/* PauseMenu.js by ThunderWire_Games * Script for Pause Game and - Save/Load Menu */
class ComponentsClass {
var BlurEffect : Blur;
var Look : MouseLook;
}
var Components : ComponentsClass = new ComponentsClass ( ) ;
var playerPosition : Transform;
var mainMenuSceneName : String;
var Skin : GUISkin;
var LoadPosition : String = "false"; //set to "true" is you want to load position or "false" to load only level
private var LoadLevel : boolean = true;
private var Look1 : MouseLook;
private var PlayerX : float;
private var PlayerY : float;
private var PlayerZ : float;
private var pauseEnabled = false;
function Start(){
PlayerPrefs.SetString("LoadPosition",LoadPosition); //set loadPosition true or false
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
LoadPlayer();
}
function SavePlayer(){
if(PlayerPrefs.GetString("LoadPosition") == "true"){ //save current position
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true"); //allow the load position
//Debug.Log("Saved to " + " X: " + PlayerPrefs.GetFloat("PlayerX") + " Y: " + PlayerPrefs.GetFloat("PlayerY") + " Z: " + PlayerPrefs.GetFloat("PlayerZ"));
}
PlayerPrefs.SetString("LevelName", Application.loadedLevelName); //save current level
}
function loadLevel(){ //load saved position
if(PlayerPrefs.GetString("LevelName") == Application.loadedLevelName){ //check if you have Loaded Level
LoadLevel = false;
}
if(LoadLevel == true){
Application.LoadLevel(PlayerPrefs.GetString("LevelName")); //load saved level
}
}
function LoadPlayer(){ //load player position on saved level
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position.x = (PlayerPrefs.GetFloat("PlayerX"));
playerPosition.transform.position.y = (PlayerPrefs.GetFloat("PlayerY"));
playerPosition.transform.position.z = (PlayerPrefs.GetFloat("PlayerZ"));
//Debug.Log("LOAD POS");
}
}
function Update(){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z); //set current player position
LoadPosition = PlayerPrefs.GetString("LoadPosition"); //check if loadPosition is true or false
//check if pause button (escape key) is pressed
if(Input.GetKeyDown("escape")){
Look1 = gameObject.GetComponent (MouseLook); //set MouseLook script
//check if game is already paused
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
Components.BlurEffect.enabled = false;
Components.Look.enabled = true;
Look1.enabled = true;
}
//else if game isn't paused, then pause it
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
Components.BlurEffect.enabled = true;
Components.Look.enabled = false;
Look1.enabled = false;
}
}
}
private var showGraphicsDropDown = false;
function OnGUI(){
GUI.skin = Skin;
if(pauseEnabled == true){
//Make a background box
GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 180,250,280), "Pause Menu");
//Make Main Menu button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(mainMenuSceneName);
}
//Make Save Game button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,50), "Save Game")){
SavePlayer();
}
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 150,250,50), "Load Game")){
loadLevel();
LoadPlayer();
}
//Make Change Graphics Quality button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
//Create the Graphics settings buttons, these won't show automatically, they will be called when
//the user clicks on the "Change Graphics Quality" Button, and then dissapear when they click
//on it again....
if(showGraphicsDropDown == true){
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
//Make quit game button
if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
Última edição por Callyde Jr em Qua Out 19, 2016 7:10 am, editado 2 vez(es)
Re: Erros nesse script?
tem como colocar o script dentro da caixa de códigos do fórum?
Clica no botão "SCRIPT", e vai aparece um quadrado... clica DENTRO deste quadrado, e cole o seu código... desta forma ele não perde a formatação.
Clica no botão "SCRIPT", e vai aparece um quadrado... clica DENTRO deste quadrado, e cole o seu código... desta forma ele não perde a formatação.
Re: Erros nesse script?
Pronto eu coloquei ele dentro de script, estou presisando de um sistema deste jeito modifiquei tanto esse script aqui mais nao deu certo ajuda aqui amigos, boa tarde a todos e obrigado
Re: Erros nesse script?
Não colocou não kkkkkkkkkkkkkk
- Código:
Cola seu script aqui jovem...
George Lucas Vieira- Avançado
- PONTOS : 3391
REPUTAÇÃO : 132
Idade : 21
Áreas de atuação : Programação, Modelagem e Animação.
Respeito as regras :
Re: Erros nesse script?
Ha sim eu estava colocando ele abaixo desse quadrado
- Código:
/* PauseMenu.js by ThunderWire_Games * Script for Pause Game and - Save/Load Menu */
class ComponentsClass {
var BlurEffect : Blur;
var Look : MouseLook;
}
var Components : ComponentsClass = new ComponentsClass ( ) ;
var playerPosition : Transform;
var mainMenuSceneName : String;
var Skin : GUISkin;
var LoadPosition : String = "false"; //set to "true" is you want to load position or "false" to load only level
private var LoadLevel : boolean = true;
private var Look1 : MouseLook;
private var PlayerX : float;
private var PlayerY : float;
private var PlayerZ : float;
private var pauseEnabled = false;
function Start(){
PlayerPrefs.SetString("LoadPosition",LoadPosition); //set loadPosition true or false
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
LoadPlayer();
}
function SavePlayer(){
if(PlayerPrefs.GetString("LoadPosition") == "true"){ //save current position
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true"); //allow the load position
//Debug.Log("Saved to " + " X: " + PlayerPrefs.GetFloat("PlayerX") + " Y: " + PlayerPrefs.GetFloat("PlayerY") + " Z: " + PlayerPrefs.GetFloat("PlayerZ"));
}
PlayerPrefs.SetString("LevelName", Application.loadedLevelName); //save current level
}
function loadLevel(){ //load saved position
if(PlayerPrefs.GetString("LevelName") == Application.loadedLevelName){ //check if you have Loaded Level
LoadLevel = false;
}
if(LoadLevel == true){
Application.LoadLevel(PlayerPrefs.GetString("LevelName")); //load saved level
}
}
function LoadPlayer(){ //load player position on saved level
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position.x = (PlayerPrefs.GetFloat("PlayerX"));
playerPosition.transform.position.y = (PlayerPrefs.GetFloat("PlayerY"));
playerPosition.transform.position.z = (PlayerPrefs.GetFloat("PlayerZ"));
//Debug.Log("LOAD POS");
}
}
function Update(){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z); //set current player position
LoadPosition = PlayerPrefs.GetString("LoadPosition"); //check if loadPosition is true or false
//check if pause button (escape key) is pressed
if(Input.GetKeyDown("escape")){
Look1 = gameObject.GetComponent (MouseLook); //set MouseLook script
//check if game is already paused
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
Components.BlurEffect.enabled = false;
Components.Look.enabled = true;
Look1.enabled = true;
}
//else if game isn't paused, then pause it
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
Components.BlurEffect.enabled = true;
Components.Look.enabled = false;
Look1.enabled = false;
}
}
}
private var showGraphicsDropDown = false;
function OnGUI(){
GUI.skin = Skin;
if(pauseEnabled == true){
//Make a background box
GUI.Box(Rect(Screen.width /2 - 100,Screen.height /2 - 180,250,280), "Pause Menu");
//Make Main Menu button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(mainMenuSceneName);
}
//Make Save Game button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,50), "Save Game")){
SavePlayer();
}
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 - 150,250,50), "Load Game")){
loadLevel();
LoadPlayer();
}
//Make Change Graphics Quality button
if(GUI.Button(Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
//Create the Graphics settings buttons, these won't show automatically, they will be called when
//the user clicks on the "Change Graphics Quality" Button, and then dissapear when they click
//on it again....
if(showGraphicsDropDown == true){
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button(Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
//Make quit game button
if (GUI.Button (Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
Re: Erros nesse script?
Ta, o que ocorre neste caso é que você está usando javaScript, e isto eh beeeeem ruim. mas tirando este fato, você possui os scripts "Blur", "MouseLook", etc, que o script pede?
Nas linhas que estão dando os erros, apenas são habilitados e desabilitados os componentes de Blur e de MouseLook. caso não os tenha, apenas retire as partes referentes a eles.
Nas linhas que estão dando os erros, apenas são habilitados e desabilitados os componentes de Blur e de MouseLook. caso não os tenha, apenas retire as partes referentes a eles.
Re: Erros nesse script?
Obrigado amigo mas nao deu certo aqui voce poderia me mostrar um parecido com esse em C#
Re: Erros nesse script?
Eu converti ele mais nao estou conseguindo arruma-lo?
- Código:
// Converted from UnityScript to C# at http://www.M2H.nl/files/js_to_c.php - by Mike Hergaarden
// Do test the code! You usually need to change a few small bits.
using UnityEngine;
using System.Collections;
public class MYCLASSNAME : MonoBehaviour {
/* PauseMenu.js by ThunderWire_Games * Script for Pause Game and - Save/Load Menu */
class ComponentsClass {
Blur BlurEffect;
MouseLook Look;
}
ComponentsClass Components = new ComponentsClass ( ) ;
Transform playerPosition;
string mainMenuSceneName;
GUISkin Skin;
string LoadPosition = "false"; //set to "true" is you want to load position or "false" to load only level
private bool LoadLevel = true;
private MouseLook Look1;
private float PlayerX;
private float PlayerY;
private float PlayerZ;
private FIXME_VAR_TYPE pauseEnabled= false;
void Start (){
PlayerPrefs.SetString("LoadPosition",LoadPosition); //set loadPosition true or false
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
LoadPlayer();
}
void SavePlayer (){
if(PlayerPrefs.GetString("LoadPosition") == "true"){ //save current position
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true"); //allow the load position
http://Debug.Log("Saved to " + " X: " + PlayerPrefs.GetFloat("PlayerX") + " Y: " + PlayerPrefs.GetFloat("PlayerY") + " Z: " + PlayerPrefs.GetFloat("PlayerZ"));
}
PlayerPrefs.SetString("LevelName", Application.loadedLevelName); //save current level
}
void loadLevel (){ //load saved position
if(PlayerPrefs.GetString("LevelName") == Application.loadedLevelName){ //check if you have Loaded Level
LoadLevel = false;
}
if(LoadLevel == true){
Application.LoadLevel(PlayerPrefs.GetString("LevelName")); //load saved level
}
}
void LoadPlayer (){ //load player position on saved level
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position.x = (PlayerPrefs.GetFloat("PlayerX"));
playerPosition.transform.position.y = (PlayerPrefs.GetFloat("PlayerY"));
playerPosition.transform.position.z = (PlayerPrefs.GetFloat("PlayerZ"));
http://Debug.Log("LOAD POS");
}
}
void Update (){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z); //set current player position
LoadPosition = PlayerPrefs.GetString("LoadPosition"); //check if loadPosition is true or false
//check if pause button (escape key) is pressed
if(Input.GetKeyDown("escape")){
Look1 = gameObject.GetComponent (MouseLook); //set MouseLook script
//check if game is already paused
if(pauseEnabled == true){
//unpause the game
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Screen.showCursor = false;
Components.BlurEffect.enabled = false;
Components.Look.enabled = true;
Look1.enabled = true;
}
//else if game isn't paused, then pause it
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Screen.showCursor = true;
Components.BlurEffect.enabled = true;
Components.Look.enabled = false;
Look1.enabled = false;
}
}
}
private FIXME_VAR_TYPE showGraphicsDropDown= false;
void OnGUI (){
GUI.skin = Skin;
if(pauseEnabled == true){
//Make a background box
GUI.Box( new Rect(Screen.width /2 - 100,Screen.height /2 - 180,250,280), "Pause Menu");
//Make Main Menu button
if(GUI.Button( new Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
Application.LoadLevel(mainMenuSceneName);
}
//Make Save Game button
if(GUI.Button( new Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,50), "Save Game")){
SavePlayer();
}
if(GUI.Button( new Rect(Screen.width /2 - 100,Screen.height /2 - 150,250,50), "Load Game")){
loadLevel();
LoadPlayer();
}
//Make Change Graphics Quality button
if(GUI.Button( new Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
//Create the Graphics settings buttons, these won't show automatically, they will be called when
//the user clicks on the "Change Graphics Quality" Button, and then dissapear when they click
//on it again....
if(showGraphicsDropDown == true){
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button( new Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
//Make quit game button
if (GUI.Button ( new Rect(Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
}
Re: Erros nesse script?
Bom dia brow! Tens como postar os erros do console? já vi que em algumas algumas funções estão obsoletas, como por exemplo o LoadLevel, não se usa mais, se usa o LoadScene. https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadScene.html .
Abraço!
Abraço!
Re: Erros nesse script?
Esses sao os erros amigo
Assets/Scripts/SaveLoad.cs(53,12): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(53,25): error CS1519: Unexpected symbol `==' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(54,38): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(54,60): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(56,5): error CS8025: Parsing error
Assets/Scripts/SaveLoad.cs(53,12): error CS1519: Unexpected symbol `if' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(53,25): error CS1519: Unexpected symbol `==' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(54,38): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(54,60): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration
Assets/Scripts/SaveLoad.cs(56,5): error CS8025: Parsing error
Re: Erros nesse script?
Bom dia Callyde! cara formatei meu PC ontem, assim que eu reinstalar a Unity, caso não for resolvido seu problema, vou testar seu script e ver se consigo ajusta-lo.
Abraço!
Abraço!
Re: Erros nesse script?
Tente isto, crie um novo script em C# com o nome "Codigo"
- Código:
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class Codigo : MonoBehaviour {
public Transform playerPosition;
public string mainMenuSceneName = "nomeCenaMenu";
string LoadPosition = "false";
bool LoadLevel = true;
float PlayerX, PlayerY, PlayerZ;
bool pauseEnabled = false, showGraphicsDropDown = false;
void Start(){
PlayerPrefs.SetString("LoadPosition",LoadPosition);
Time.timeScale = 1;
AudioListener.volume = 1;
Cursor.visible = false;
LoadPlayer();
}
void SavePlayer(){
if(PlayerPrefs.GetString("LoadPosition") == "true"){
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true");
}
PlayerPrefs.SetString("LevelName", SceneManager.GetActiveScene().name);
}
void loadLevel(){
if(PlayerPrefs.GetString("LevelName") == SceneManager.GetActiveScene().name){
LoadLevel = false;
}
if(LoadLevel == true){
SceneManager.LoadScene(PlayerPrefs.GetString("LevelName"));
}
}
void LoadPlayer(){
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position = new Vector3 ((PlayerPrefs.GetFloat ("PlayerX")), (PlayerPrefs.GetFloat ("PlayerY")), (PlayerPrefs.GetFloat ("PlayerZ")));
}
}
void Update(){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z);
LoadPosition = PlayerPrefs.GetString("LoadPosition");
if(Input.GetKeyDown("escape")){
if(pauseEnabled == true){
pauseEnabled = false;
Time.timeScale = 1;
AudioListener.volume = 1;
Cursor.visible = false;
}
else if(pauseEnabled == false){
pauseEnabled = true;
AudioListener.volume = 0;
Time.timeScale = 0;
Cursor.visible = true;
}
}
}
void OnGUI(){
if(pauseEnabled == true){
GUI.Box(new Rect(Screen.width /2 - 100,Screen.height /2 - 180,250,280), "Pause Menu");
if(GUI.Button(new Rect(Screen.width /2 - 100,Screen.height /2 - 50,250,50), "Main Menu")){
SceneManager.LoadScene(mainMenuSceneName);
}
if(GUI.Button(new Rect(Screen.width /2 - 100,Screen.height /2 - 100,250,50), "Save Game")){
SavePlayer();
}
if(GUI.Button(new Rect(Screen.width /2 - 100,Screen.height /2 - 150,250,50), "Load Game")){
loadLevel();
LoadPlayer();
}
if(GUI.Button(new Rect(Screen.width /2 - 100,Screen.height /2 ,250,50), "Change Graphics Quality")){
if(showGraphicsDropDown == false){
showGraphicsDropDown = true;
}
else{
showGraphicsDropDown = false;
}
}
if(showGraphicsDropDown == true){
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.SetQualityLevel (0);
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.SetQualityLevel (1);
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.SetQualityLevel (2);;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.SetQualityLevel (3);
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.SetQualityLevel (4);
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.SetQualityLevel (5);
}
if(Input.GetKeyDown("escape")){
showGraphicsDropDown = false;
}
}
if (GUI.Button (new Rect (Screen.width /2 - 100,Screen.height /2 + 50,250,50), "Quit Game")){
Application.Quit();
}
}
}
}
Re: Erros nesse script?
Se não funcionar, diga ai (por que não pude testar, apenas converter). Mas se funcionar, então ja é :D
Re: Erros nesse script?
Boa noite
Marcos esta funcionando Save e Load mais a parte de configuraçao nao esta podendo mexer
Marcos esta funcionando Save e Load mais a parte de configuraçao nao esta podendo mexer
Re: Erros nesse script?
hmm estranho.
A parte de configurações é feita especificamente para pegar os indices de configurações O.o
Tente isto: vá em
edit>ProjectSettings>Quality
Nesta aba, clique na engrenagem pequena lá em cima, e clique em Reset
A parte de configurações é feita especificamente para pegar os indices de configurações O.o
Tente isto: vá em
edit>ProjectSettings>Quality
Nesta aba, clique na engrenagem pequena lá em cima, e clique em Reset
Re: Erros nesse script?
Nao esta funcionando aparece os butoes igual ao do MENU ele esta assim ficou igual aquele menu que voce fez
Re: Erros nesse script?
Então tente usar o nome das classes mesmo, talvez dê certo
- Código:
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 ,250,50), "Fastest")){
QualitySettings.currentLevel = QualityLevel.Fastest;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 50,250,50), "Fast")){
QualitySettings.currentLevel = QualityLevel.Fast;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 100,250,50), "Simple")){
QualitySettings.currentLevel = QualityLevel.Simple;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 150,250,50), "Good")){
QualitySettings.currentLevel = QualityLevel.Good;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 200,250,50), "Beautiful")){
QualitySettings.currentLevel = QualityLevel.Beautiful;
}
if(GUI.Button(new Rect(Screen.width /2 + 150,Screen.height /2 + 250,250,50), "Fantastic")){
QualitySettings.currentLevel = QualityLevel.Fantastic;
}
Re: Erros nesse script?
Boa tarde amigos
nao funcionou Marcos talvez funcione criando um botao na tela para quando apertamos (ESC) com o muse apertamosobutao da tela e aparecendo o menu save e load ou um lugar com um objeto que ao emcostar apareça o save e load,
temtei fazer aqui mas nao consegui
nao funcionou Marcos talvez funcione criando um botao na tela para quando apertamos (ESC) com o muse apertamosobutao da tela e aparecendo o menu save e load ou um lugar com um objeto que ao emcostar apareça o save e load,
temtei fazer aqui mas nao consegui
Re: Erros nesse script?
Bom dia ja amigo mas nao deu certo uma ora ele pausa o jogo e outra fica se movendo e os otoes ficam sem açoes , estou tentando e pesquisando para fazer um parecido com o do Resident Evil, coloco um objeto tipo uma maquina de escrever quando chegar perto apertando E aparece uma opçao para salvar
Re: Erros nesse script?
Aquele meu MenuPause serviria se fosse adaptado com um pouco de PlayerPrefs e um Vector3.Distance para checar a distância da máquina de escrever... mas a parte do PlayerPrefs não teria como fazer separadamente... você tem que fazer por conta, pois ela depende das variáveis que você tem no seu jogo.
Re: Erros nesse script?
Bom dia amigos
Hummm e verdade Marcos e bem isso que eu estou tentando fazer,
e ja tenho um script pronto aqui ele esta salvando o mapa mais a posiçao nao.
Fiz tambem com esse script de pause seu funciona depois ele para de funcionar olha o script aqui
Hummm e verdade Marcos e bem isso que eu estou tentando fazer,
e ja tenho um script pronto aqui ele esta salvando o mapa mais a posiçao nao.
Fiz tambem com esse script de pause seu funciona depois ele para de funcionar olha o script aqui
- Código:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityStandardAssets.Characters.FirstPerson;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
using System.Linq;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
[RequireComponent(typeof(FirstPersonController))]
public class MenuPause : MonoBehaviour {
// save e load
public Transform playerPosition;
string LoadPosition = "false";
bool LoadLevel = true;
float PlayerX, PlayerY, PlayerZ;
// Butoes
public Button BotaoRetornarAoJogo,BotaoOpcoes,BotaoVoltarAoMenu,BotaoSave,BotaoLoad;
[Space(20)]
public Slider BarraVolume;
public Toggle CaixaModoJanela;
public Dropdown Resolucoes, Qualidades;
public Button BotaoVoltar, BotaoSalvarPref;
[Space(20)]
public Text textoVol;
public string nomeCenaMenu = "MENU";
private float VOLUME;
private int qualidadeGrafica, modoJanelaAtivo, resolucaoSalveIndex;
private bool telaCheiaAtivada, menuParte1Ativo, menuParte2Ativo;
private Resolution[] resolucoesSuportadas;
private FirstPersonController controlador;
void Awake(){
resolucoesSuportadas = Screen.resolutions;
controlador = GetComponent<FirstPersonController> ();
}
void Start () {
PlayerPrefs.SetString("LoadPosition",LoadPosition);
LoadPlayer();
Opcoes (false,false);
ChecarResolucoes ();
AjustarQualidades ();
Time.timeScale = 1;
AudioListener.volume = 1;
BarraVolume.minValue = 0;
BarraVolume.maxValue = 1;
menuParte1Ativo = menuParte2Ativo = false;
if (PlayerPrefs.HasKey ("RESOLUCAO")) {
int numResoluc = PlayerPrefs.GetInt ("RESOLUCAO");
if (resolucoesSuportadas.Length <= numResoluc) {
PlayerPrefs.DeleteKey ("RESOLUCAO");
}
}
//=============== SAVES===========//
if (PlayerPrefs.HasKey ("VOLUME")) {
VOLUME = PlayerPrefs.GetFloat ("VOLUME");
BarraVolume.value = VOLUME;
} else {
PlayerPrefs.SetFloat ("VOLUME", 1);
BarraVolume.value = 1;
}
//=============MODO JANELA===========//
if (PlayerPrefs.HasKey ("modoJanela")) {
modoJanelaAtivo = PlayerPrefs.GetInt ("modoJanela");
if (modoJanelaAtivo == 1) {
Screen.fullScreen = false;
CaixaModoJanela.isOn = true;
} else {
Screen.fullScreen = true;
CaixaModoJanela.isOn = false;
}
} else {
modoJanelaAtivo = 0;
PlayerPrefs.SetInt ("modoJanela", modoJanelaAtivo);
CaixaModoJanela.isOn = false;
Screen.fullScreen = true;
}
//========RESOLUCOES========//
if (modoJanelaAtivo == 1) {
telaCheiaAtivada = false;
} else {
telaCheiaAtivada = true;
}
if (PlayerPrefs.HasKey ("RESOLUCAO")) {
resolucaoSalveIndex = PlayerPrefs.GetInt ("RESOLUCAO");
Screen.SetResolution(resolucoesSuportadas[resolucaoSalveIndex].width,resolucoesSuportadas[resolucaoSalveIndex].height,telaCheiaAtivada);
Resolucoes.value = resolucaoSalveIndex;
} else {
resolucaoSalveIndex = (resolucoesSuportadas.Length -1);
Screen.SetResolution(resolucoesSuportadas[resolucaoSalveIndex].width,resolucoesSuportadas[resolucaoSalveIndex].height,telaCheiaAtivada);
PlayerPrefs.SetInt ("RESOLUCAO", resolucaoSalveIndex);
Resolucoes.value = resolucaoSalveIndex;
}
//=========QUALIDADES=========//
if (PlayerPrefs.HasKey ("qualidadeGrafica")) {
qualidadeGrafica = PlayerPrefs.GetInt ("qualidadeGrafica");
QualitySettings.SetQualityLevel(qualidadeGrafica);
Qualidades.value = qualidadeGrafica;
} else {
QualitySettings.SetQualityLevel((QualitySettings.names.Length-1));
qualidadeGrafica = (QualitySettings.names.Length-1);
PlayerPrefs.SetInt ("qualidadeGrafica", qualidadeGrafica);
Qualidades.value = qualidadeGrafica;
}
// =========SETAR BOTOES==========//
BotaoSave.onClick = new Button.ButtonClickedEvent();
BotaoLoad.onClick = new Button.ButtonClickedEvent();
BotaoVoltarAoMenu.onClick = new Button.ButtonClickedEvent();
BotaoOpcoes.onClick = new Button.ButtonClickedEvent();
BotaoRetornarAoJogo.onClick = new Button.ButtonClickedEvent();
BotaoVoltar.onClick = new Button.ButtonClickedEvent();
BotaoSalvarPref.onClick = new Button.ButtonClickedEvent();
//
BotaoVoltarAoMenu.onClick.AddListener(() => VoltarAoMenu());
BotaoOpcoes.onClick.AddListener(() => Opcoes(false,true));
BotaoRetornarAoJogo.onClick.AddListener(() => Opcoes(false,false));
BotaoVoltar.onClick.AddListener(() => Opcoes(true,false));
BotaoSalvarPref.onClick.AddListener(() => SalvarPreferencias());
BotaoSave.onClick.AddListener(() => SavePlayer());
BotaoLoad.onClick.AddListener(() => loadLevel());
}
void Update(){
PlayerX =(playerPosition.transform.position.x); PlayerY =(playerPosition.transform.position.y); PlayerZ =(playerPosition.transform.position.z);
LoadPosition = PlayerPrefs.GetString("LoadPosition");
if (Input.GetKeyDown (KeyCode.Escape)) {
if (menuParte1Ativo == false && menuParte2Ativo == false) {
menuParte1Ativo = true;
menuParte2Ativo = false;
Opcoes (true, false);
Time.timeScale = 0;
AudioListener.volume = 0;
} else if (menuParte1Ativo == true && menuParte2Ativo == false) {
menuParte1Ativo = menuParte2Ativo = false;
Opcoes (false, false);
Time.timeScale = 1;
AudioListener.volume = VOLUME;
}
else if (menuParte1Ativo == false && menuParte2Ativo == true) {
menuParte1Ativo = true;
menuParte2Ativo = false;
Opcoes (true, false);
Time.timeScale = 0;
AudioListener.volume = 1;
}
}
if (menuParte1Ativo == true || menuParte2Ativo == true) {
Cursor.visible = true;
controlador.enabled = false;
} else {
Cursor.visible = false;
controlador.enabled = true;
}
}
//=========VOIDS DE CHECAGEM==========//
private void ChecarResolucoes(){
Resolution[] resolucoesSuportadas = Screen.resolutions;
Resolucoes.options.Clear ();
for(int y = 0; y < resolucoesSuportadas.Length; y++){
Resolucoes.options.Add(new Dropdown.OptionData() { text = resolucoesSuportadas[y].width + "x" + resolucoesSuportadas[y].height });
}
Resolucoes.captionText.text = "Resolucao";
}
private void AjustarQualidades(){
string[] nomes = QualitySettings.names;
Qualidades.options.Clear ();
for(int y = 0; y < nomes.Length; y++){
Qualidades.options.Add(new Dropdown.OptionData() { text = nomes[y] });
}
Qualidades.captionText.text = "Qualidade";
}
private void Opcoes(bool ativarOP, bool ativarOP2){
BotaoVoltarAoMenu.gameObject.SetActive (ativarOP);
BotaoOpcoes.gameObject.SetActive (ativarOP);
BotaoRetornarAoJogo.gameObject.SetActive (ativarOP);
BotaoSave.gameObject.SetActive (ativarOP);
BotaoLoad.gameObject.SetActive (ativarOP);
//
textoVol.gameObject.SetActive (ativarOP2);
BarraVolume.gameObject.SetActive (ativarOP2);
CaixaModoJanela.gameObject.SetActive (ativarOP2);
Resolucoes.gameObject.SetActive (ativarOP2);
Qualidades.gameObject.SetActive (ativarOP2);
BotaoVoltar.gameObject.SetActive (ativarOP2);
BotaoSalvarPref.gameObject.SetActive (ativarOP2);
if (ativarOP == true && ativarOP2 == false) {
menuParte1Ativo = true;
menuParte2Ativo = false;
}
else if (ativarOP == false && ativarOP2 == true) {
menuParte1Ativo = false;
menuParte2Ativo = true;
}
else if (ativarOP == false && ativarOP2 == false) {
menuParte1Ativo = false;
menuParte2Ativo = false;
Time.timeScale = 1;
AudioListener.volume = VOLUME;
}
}
//=========VOIDS DE SALVAMENTO==========//
private void SalvarPreferencias(){
if (CaixaModoJanela.isOn == true) {
modoJanelaAtivo = 1;
telaCheiaAtivada = false;
} else {
modoJanelaAtivo = 0;
telaCheiaAtivada = true;
}
PlayerPrefs.SetFloat ("VOLUME", BarraVolume.value);
PlayerPrefs.SetInt ("qualidadeGrafica", Qualidades.value);
PlayerPrefs.SetInt ("modoJanela", modoJanelaAtivo);
PlayerPrefs.SetInt ("RESOLUCAO", Resolucoes.value);
resolucaoSalveIndex = Resolucoes.value;
AplicarPreferencias ();
}
private void AplicarPreferencias(){
VOLUME = PlayerPrefs.GetFloat ("VOLUME");
QualitySettings.SetQualityLevel(PlayerPrefs.GetInt ("qualidadeGrafica"));
Screen.SetResolution(resolucoesSuportadas[resolucaoSalveIndex].width,resolucoesSuportadas[resolucaoSalveIndex].height,telaCheiaAtivada);
}
private void VoltarAoMenu(){
SceneManager.LoadScene ("MENU");
AudioListener.volume = 1;
Debug.Log ("Voutar ao Menu");
}
private void SavePlayer(){
if(PlayerPrefs.GetString("LoadPosition") == "true"){
PlayerPrefs.SetFloat("PlayerX",PlayerX);
PlayerPrefs.SetFloat("PlayerY",PlayerY);
PlayerPrefs.SetFloat("PlayerZ",PlayerZ);
PlayerX =(playerPosition.transform.position.x);
PlayerY =(playerPosition.transform.position.y);
PlayerZ =(playerPosition.transform.position.z);
PlayerPrefs.SetString("LoadPosition", "true");
}
PlayerPrefs.SetString("LevelName", SceneManager.GetActiveScene().name);
Debug.Log ("Jogo Salvo");
}
private void loadLevel(){
if(PlayerPrefs.GetString("LevelName") == SceneManager.GetActiveScene().name){
LoadLevel = false;
}
if(LoadLevel == true){
SceneManager.LoadScene(PlayerPrefs.GetString("LevelName"));
Debug.Log ("Carregando cena");
}
}
private void LoadPlayer(){
if(LoadLevel == false && PlayerPrefs.GetString("LoadPosition") == "true"){
playerPosition.transform.position = new Vector3 ((PlayerPrefs.GetFloat ("PlayerX")), (PlayerPrefs.GetFloat ("PlayerY")), (PlayerPrefs.GetFloat ("PlayerZ")));
loadLevel();
LoadPlayer();
Debug.Log ("Carregando cena");
}
}
}
Tópicos semelhantes
» Erros nesse script
» Como posso setar o valor nesse script?
» oque eu tenho que colocar nesse script?
» Erros Diversos no Script
» Erros do Script
» Como posso setar o valor nesse script?
» oque eu tenho que colocar nesse script?
» Erros Diversos no Script
» Erros do Script
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos