|
I'm using a raycast detection to activate a boolean function in another script. This boolean then turns on or off a OnGUI screen. The problem that I'm having is when the state is true, the OnGUI flashes on/off like it's switching between true/false rapidly. Is there a way that I can only call the function when the collision state changes, not on every frame? From the collider script:
From the OnGUI script:
}
(comments are locked)
|
|
You can try using OnTriggerStay() instead of ray casting to check if you're within range of the dog and attach a sphere collder to it. If you only want the GUI to appear when you're facing the dog and you try a combination of rays and triggers so that if you are a) facing the dag and b) within the sphere collider then showIntro is true. If you leave the trigger showIntro = false so that once the GUI is on it'll stay on until you walk away even if you turn the player around. e.g.
(comments are locked)
|
|
Solved this by doing like spinaljack said and added another boolean.
(comments are locked)
|
