Scene transition

I don’t understand why friends don’t delete the scene during menu transitions, can you help me?

var SahneDegisim = pc.createScript('sahneDegisim');

SahneDegisim.attributes.add("sceneId", {type: "string", default: "0", title: "Scene ID to Load"});

//SahneDegisim.attributes.add('controllerEntity', { type: 'entity' });

// initialize code called once per entity
SahneDegisim.prototype.initialize = function() 
{
    //this.entity.collision.on('collisionstart', this.onCollisionStart, this);
    this.entity.element.on("mouseente",this.onEnter,this);
    this.entity.element.on("mousedown",this.onPress,this);
    this.entity.element.on("mouseup",this.onRelease,this);
    this.entity.element.on("mouseleave",this.onLeave,this);
    
    this.entity.element.on("touchstart",this.onPress,this);
    this.entity.element.on("touchend",this.onRelease,this);
};


SahneDegisim.prototype.onPress = function(event) {
    var oldHierarchy = this.app.root.findByName('Root'); 
    oldHierarchy.destroy();
    this.loadScene(this.sceneId,function(){
    });
};


SahneDegisim.prototype.onCollisionStart = function(){
};

SahneDegisim.prototype.loadScene = function(id,callback) {
    var url=id+".json";
    this.app.loadSceneHierarchy(url,function(err,parent){
        if(!err)
            callback(parent);
        else 
            console.error(err);
    });
};

2 posts were merged into an existing topic: How to destroy the whole scene