I attach 2 scripts to character.
1 is all about moving and attack.
other 1 is about HP and hit/death things.
So, I need to connect some functions and var things between 2 scripts.
How can I?
Especially, if my A script has (var asd = true;), and if I want to change that asd to false or again true in my B script and so that also influence to in A script, how?
Please help.
Thanks.
thanks.
But I just want to change A script’s some boolean things from B script. (true/false)
Is this possible with GetComponent?
What u need is a static var that can be got too from your other scripts.
Small Example
//I'm on script A
static var bool_1 : boolean;
//Im script B
function Update() {
if(Input.GetButtonDown("Jump")) {
script_A_Name.bool_1 = true;
}
}
Tip(if your script has a static bool(i think)you cant have any spaces in the name so use underscores)
8)
I like to create a static int var thats not controled by time or delta time, that way you can creat as many conditions of the same static var.
Like if((scriptName.staticVarInt ==1) (scriptName.staticVarInt<=2)) { //do something.
To activate the int all u need is.
scriptName.staticVarInt = 1;