[SOLVED] Script on button to close 2d screen

Hello, i have this script to close a 2d text screen at the start of the game that seems to not work anymore, any clue why?

var Intro = pc.createScript('intro');

// initialize code called once per entity
Intro.prototype.initialize = function() {
    this.entity.element.on('mouseup', this.onRelease, this);
    var touch = this.app.touch;
    if (touch) {
        touch.on(pc.EVENT_TOUCHEND, this.onRelease, this);

// update code called every frame
Intro.prototype.update = function(dt) {

Intro.prototype.onRelease= function(that) {
    this.app.root.findByName("2D Screen").enabled=false;

Hey @ayrin, did you double-check that the script is enabled? The syntax looks good to me.

Make sure there is only a single entity in scene hierarchy called “2D Screen”. You might be disabling something else. I would also recommend searching only once during initialize and afterwards only using direct reference. Scene search is expensive, especially if you have many entities in the scene.

// pseudo code

initialize() {
    this.myEntity = this.app.root.findByName('My Entity');

onClick() {
    this.myEntity.enabled = false;

Yes i know the unique name issue, i checked and it works when launched directly from the game scene, when coming from login scene it doesn’t work, the enabled value got set to false but the 2d screen doesn’t disappear. Checked from console. I wonder why.

Ok found the issue, i had a 2D Screen name also in login scene and it was not deleted so i had a duplication. Changed one name and solved. Thanks.