“mensaje” is the GameObject I want to instanciate.
“posicion mensaje” is the empty GameObject used as a position where I want to instantiate my “mensaje” GameObject.
I’m checking 24 times per second if activate is activated and when it’s activate I instantiate the object, my “mensaje” GamObject in the desired position.
Well, I can’t print any of my messages “bien” or “mal”.
I’ve created first script “global_counter_script” the global variables used in the other two scripts which modify them:
static var globos_azules_explotados:int=0 ;
static var globos_rojos_explotados:int=0 ;
static var globos_amarillos_explotados:int=0 ;
static var goal_azules: boolean;
And in the second script I’ve modified (incremented) the value of some global variables
private var globos_rojos_explotados:int ;
private var globos_amarillos_explotados:int ;
private var globos_azules_explotados:int ;
private var activate:boolean;
.
.
.
//after some instructions:
if (tipo_globo =="globo_normal_azul(Clone)")
{
print("entro azul");
Contador_global.globos_azules_explotados++; //acedemos a la variable global que cuenta el número de globos azules explotados
if (Contador_global.globos_azules_explotados==1)
{
print("llegamos_a uno");
activate=true;
}
}
I can print my messages in this, from second script using the global variables as you can watch, but I can’t evaluate the global variable in the third script as I’ve done in the second one.
And this is the script where I want to check the condition based in a global variable created in the first script.
var mensaje:GameObject;
var posicion_mensaje: Transform;
private var activate:boolean=false;
function update()
{
if (activate==true)
{
print("bien");
var go=Instantiate(mensaje, transform.position, transform.rotation);
}
else
{
print("mal");
}
}
Thank you very much in advance.