SetActive for a sertain time?

Hello i want to set up some text im my game so when i enter a serain trigger it should be visable but after like 2 or 3 secounds it should be invisable again. How do i manage this?


My code:
#pragma strict

var Text1 : GameObject;

function Start () 

function OnTriggerStay (other : Collider) 
	if(other.tag == "Player")
		Destroy(gameObject, 1.5);

TriggerStay is called all the time for as long as there is some interaction.
Instead try the simplest thing of using a small function with yield waitforseconds.

function WaitForMe(){
   yield WaitForSeconds(secondsToWait);

Call that through

function OnTriggerEnter(col:Collider){
   if(col.CompareTag("Player") ){
     WaitForMe( how many seconds you want here );

Don’t forget to declare the seconds variable at the beginning of the script.
You’ll be able to put the seconds through the editor instead of changing and compiling the script.