Adding geo at runtime redux

This is how I’ve done it in the past: Load 3D models at run time from a PlayCanvas application

var Sandbox = pc.createScript('sandbox');

Sandbox.URL = 'https://raw.githubusercontent.com/yaustar/3dmodel-Playcanvas/master/Gas%20Station.json';

// initialize code called once per entity
Sandbox.prototype.initialize = function() {
    this.app.assets.loadFromUrl(Sandbox.URL, "model", function (err, asset) {
        var entity = new pc.Entity();
        entity.addComponent("model");
        entity.model.model = asset.resource;
        pc.app.root.addChild(entity);
    });
};

// swap method called for script hot-reloading
// inherit your script state here
// Sandbox.prototype.swap = function(old) { };

// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/