Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Text display after a certain time after the entry into trigger.

$
0
0
I wrote this script: private var enter : boolean; //var off: boolean = false; function Start() { enter = false; } function OnTriggerEnter (other : Collider){ if (other.gameObject.tag == "Player") { enter = true; print ("work?"); //enter = false; if (Input.GetKey (KeyCode.DownArrow)) { print ("Click"); Invoke("text", 5); } } } function text() { if(enter){ print ("5 seconds after"); } } function OnTriggerExit (other : Collider){ if (other.gameObject.tag == "Player") { print ("Exit"); enter = false; } } I have one question, when a player enters the trigger and click arrow down after 5 seconds is show in the display "5 seconds after" but this is not happening. What is wrong?

Viewing all articles
Browse latest Browse all 171066

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>