Throwing null reference exception for oldHierarchy while reloading the same scene from second time onwards

Scene gets reloaded for the first time. Issue occurs from second time onwards.

Movement.prototype.reloadScene = function() {

    // Get a reference to the scene's root object

    var oldHierarchy ='Root');





    // Get the path to the scene

    var scene =;


    // Remove mouse and touch events

    if (;

    if (;

    // Load the scenes entity hierarchy, function (err, parent) {

        if (!err) {


        } else {





The code generally looks fine although

    if (;

    if (;

You shouldn’t do this as it also removes all the event listeners from the systems in the engine such as UI input.

If you can share a project with the issue, that would help a lot.

Also, we recently added documentation about scene loading which may help: Loading Scenes | Learn PlayCanvas