ya lo e solucionado el error estaba en que tenia que declarar variebles para cada getcomponent y luego el texto igualarlo a esas variables y asi me a funcionado
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Páginas1
#1
General (Antiguo) / Como pasar valores de variables entre scripts?
Noviembre 15, 2017, 01:08:54 PM #2
General (Antiguo) / Como pasar valores de variables entre scripts?
Noviembre 15, 2017, 01:11:39 AM
hola tengo un ligero problema con esta script
no me salta error pero no me sale en el texto lo que tendria que salir solo me sale el nombre del player... como puedo hacerlo?
var scriptDialogos;
private var texto : String;
function Start () {
scriptDialogos = GameObject.Find("ScriptDialogos");
Empezar();
}
function Update () {
}
function Empezar (){
texto = scriptDialogos.GetComponent(Dialogos).dialogo1 + player.name + scriptDialogos.GetComponent(Dialogos).dialogo2;
}
no me salta error pero no me sale en el texto lo que tendria que salir solo me sale el nombre del player... como puedo hacerlo?
#3
General (Antiguo) / Duda con JS
Noviembre 09, 2017, 07:31:36 PM
me salia error me decia
whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.
vale cambiare while por if yo creo que asi funcionara
gracias voy a probarlo ahora
whose type could not be resolved because of a cycle. Explicitly declare the type of either one to break the cycle.
vale cambiare while por if yo creo que asi funcionara
gracias voy a probarlo ahora
#4
General (Antiguo) / Duda con JS
Noviembre 09, 2017, 03:03:14 PM
entonces si pusiera esto en el segundo while
lo ejecutaria de nuevo desde el principio con un texto nuevo sin necesidad de declarar frase = 0 o lo que sea...
var mensaje : UI.Text;
var cuadro : GameObject;
var texto1 : String;
var player : GameObject;
var texto2 : String;
var letra : int;
var fin = 0;
private var texto : String;
var playerSentado : GameObject;
function Start () {
Empezar();
}
function Update () {
}
function Empezar (){
if(fin == 0){texto = texto1 +player.name + texto2;}
if(fin == 1){texto = "Dialogo 2";}
//texto = texto1 +player.name + texto2;
StartCoroutine(dictado(texto));
}
function dictado (frase : String){
mensaje.text ="";
while ( letra < frase.length){
mensaje.text += frase[letra];
letra += 1;
yield WaitForSeconds(0.2f);
}
while ( letra >= frase.length){
yield WaitForSeconds(0.2f);
mensaje.text = "";
yield WaitForSeconds(1f);
//cuadro.SetActive(false);
player.SetActive(true);
playerSentado.SetActive(false);
"yield return StartCoruotine(....)"// ejemplo
fin = 1;
print(frase.Length);
Empezar();
}
}
lo ejecutaria de nuevo desde el principio con un texto nuevo sin necesidad de declarar frase = 0 o lo que sea...
#5
General (Antiguo) / problemillas con DontDestroyOnLoad
Noviembre 07, 2017, 07:53:00 PM
hola como puedo hacer que unos objetos sigan en cada escena al personaje son por ejemplo la barra de vida y eso por no estar creándolas en cada escena supongo que con eso de DontDestroyOnLoad se puede pero no lo entiendo muy bien trabajo con js no se si hay se puede hacer....
gracias un saludo
gracias un saludo
#6
General (Antiguo) / Duda con JS
Noviembre 07, 2017, 07:29:41 PM
Hola tengo un problema con esta script
var mensaje : UI.Text;
var cuadro : GameObject;
var texto1 : String;
var player : GameObject;
var texto2 : String;
var letra : int;
var fin = ;
private var texto : String;
var playerSentado : GameObject;
function Start () {
Empezar();
}
function Update () {
}
function Empezar (){
if(fin == ){texto = texto1 +player.name + texto2;}
if(fin == 1){texto = "Dialogo 2";}
//texto = texto1 +player.name + texto2;
StartCoroutine(dictado(texto));
}
function dictado (frase : String){
mensaje.text ="";
while ( letra < frase.length){
mensaje.text += frase[letra];
letra += 1;
yield WaitForSeconds(0.2f);
}
while ( letra >= frase.length){
yield WaitForSeconds(0.2f);
mensaje.text = "";
yield WaitForSeconds(1f);
//cuadro.SetActive(false);
player.SetActive(true);
playerSentado.SetActive(false);
texto = "";
frase = "";
letra = ;
fin = 1;
print(frase