[SOLVED] How to make hotspot work properly?

Hello! I’m developing a game for a school project, it’s basically touring around a space with info in selected spots. I want the certain info to pop up only if the player will walk near it.

I need help with figuring out the right code to enable showing the unenabled sprite named “info1, info2, …” whenever my player will collide into it.

Here’s the editor to my file: PlayCanvas | HTML5 Game Engine

A guidance or any lead will be greatly appreciated. Thank you so much!

@lestortal Enabling/Disabling items in PC is done by using it’s enabled attribute. Here is an example below.

// Enter trigger
ItemPickup.prototype.onTriggerEnter = function(object) {

    if(object.tags.has('player')) {

        // play the pickup sound
        if(this.entity.sound) this.entity.sound.play("Pickup");
              
        // increase the munitions amount
        console.log("pickup");

        // Increase item amount
        object.fire("player:addhealth",this.amount);

        // Disable after Pickup
        this.entity.enabled = false;
           
    }

};

In this example I am setting enabled to false after walking over the specific item that I am colliding with. In your case you have some specific names so you could use something like findByName.

 this.entity = this.app.root.findByName('info1');

this.entity.enabled = true;

Here are some helpful links.
ScriptComponent | PlayCanvas API Reference

Entity | PlayCanvas API Reference