One click scripts parser

Not sure how help this one is.

I noticed that i could list all the script names in the console in the editor. I asked AI to make me a script that upon parsing that one script, all the scripts in the codebase to be auto parser (instead of parsing each individual script i made changes to)

Do let me know if any existing tool exists that does the same.

var ScriptReloader = pc.createScript('scriptReloader');

ScriptReloader.attributes.add('skipList', {

    type: 'string',

    array: true,

    default: ['ammo.js', 'ammo.wasm.js', 'tween.umd.js', 'tween.umd'],

    title: 'Skip List',

    description: 'Script asset names to exclude from reloading'

});


/**
 * Called once when the script component is first created.
 */
ScriptReloader.prototype.initialize = function () {
    console.log('[ScriptReloader] Ready — save this script to reload all others.');

};

/**
 * PlayCanvas calls swap() automatically every time THIS script file is saved/hot-reloaded.
 * That makes it the perfect trigger to reload everything else.
 */

ScriptReloader.prototype.swap = function (old) {
    // Carry over attributes from the previous instance

    this.skipList = old.skipList;

    console.log('[ScriptReloader] Save detected — reloading all scripts...');

    this.reloadAll();

};

ScriptReloader.prototype.reloadAll = function () {
    var app = this.app;
    var skipNames = (this.skipList || []).concat(['ScriptReloader.js']);
    var reloaded = [];
    var skipped = [];

    app.assets.list()
        .filter(function (asset) {
            return asset.type === 'script';
        })

        .forEach(function (asset) {

            if (skipNames.indexOf(asset.name) !== -1) {

                skipped.push(asset.name);

                return;

            }

            asset.unload();

            app.assets.load(asset);

            reloaded.push(asset.name);

        });




    console.log('[ScriptReloader] Reloaded (' + reloaded.length + '):', reloaded);

    if (skipped.length) {

        console.log('[ScriptReloader] Skipped (' + skipped.length + '):', skipped);

    }

};

There is no tool for parsing all scripts. Your script seems like a workaround using a swap feature, which was not inteded for those purposes. It should allow to hot reload changes in the Launcher, not to update script attributes in the Editor. I am surprised it works even. If the Editor truly updates those attributes, it is an accident and you should not rely upon it as it might break later. If you really need to update all attributes in all scripts, feel free to create a new ticket for a feature request in Editor repository: