[SOLVED] Make texts disappear

Hi,

I am making a horror game. I want to achieve that when the player is talking after 20 seconds it disappears.
I am not sure if this is possible yet in PlayCanvas since I’ve seen nobody do it before or neither myself.
I will wait to see your answers.
For now, bye.

I don’t know how you want to achieve the effect but you can use setTimeOut function to disable text after 20 seconds. Here is an example :
setTimeout(function(){ player.enabled = false; }, 20000);

3 Likes

I got an error after 20 seconds?


Hi @Gabriel_Dobrzynski! You have to replace player in that line of code with the entity that you want to disable.

1 Like

Thanks @Albertos, That will help alot!

1 Like

If the script is on the entity that you want to disable you can just use this.entity instead of player.

1 Like

It is. So, I will absolutely do that.

1 Like

Another error?

The way below will solve that error.

setTimeout(function(){
    this.entity.enabled = false;
}.bind(this), 20000);
1 Like