Hello there
i have these problem , in my scene I create player and cube collider(trigger) i add to player .
My idea is to make only one collider which will be something like distance check.
So if NPC with Q is in player distance check collider set variabile to true and let the
Quest info pop-up. But it doesnt work … variabile wont turn to true
here is my scripts
first one distance check
static var nearNPC = false;
function Start () {
}
function Update () {
}
function OnTriggerEnter (other : Collider)
{
if (other.gameObject.CompareTag ("TalkingNPC")) {
nearNPC = true;
}
}
function OnTriggerExit (other : Collider)
{
if (other.gameObject.CompareTag ("TalkingNPC")) {
nearNPC = false;
}
}
second one … do something
var clicked = false;
var endedQ2 = false ;
function OnMouseUp () {
clicked = true ;
}
function OnGUI () {
if( clicked == true endedQ2 == false PlayerDistance.nearNPC == true)
{
and blah blah blah...
clicking on gameObject work properly
thanks ![]()