I’m not exactly new to Unity anymore, but I’m still struggling to grasp accessing other scripts through code.
In my most recent game, i’m trying to access a boolean from another script which says whether an object has triggered collider or not.
However I have 2 problems…
I’ve inserted * around the problem lines of code for easier understanding.
FallingblockcolliderScript:
*var collidertouch : boolean;*
function Start () {
collidertouch = false;
}
function OnTriggerEnter(otherObject: Collider){
if(otherObject.gameObject.tag == "Player"){
collidertouch = true;
}
}
FallingblockScript
function Start(){
wallhit = true;
var someScript : FallingblockcolliderScript;
someScript = GetComponent (FallingblockcolliderScript);
someScript.collidertouch ();
}
function Update () {
if (wallhit == false){
fall();
}
*if (someScript.collidertouch == true){*
rise();
}
}
Yep, It’s probably obvious, but if I dont ask I’ll never learn