Also I saw that you declare your function outside of the script declaration using:
function test(){} etc.
You would be better doing something like this:
LoadModel.prototype.test = function() {
// then you would invoke the running PlayCanvas application instance like this:
this.app.assets.load(modelAsset);
};
And you can call that method in your initialize or update method in this manner:
Hi … I forgot to mention that I am doing everything in an externally created GUI … so the examples I use are all run directly in Chrome Console to test (I will edit). I have no interest nor need to do things the “Playcanvas way”.
If you took that code and run it in console it works fine except of course when it hits line 42. The answer to everything.
Although you want to do things in the Chrome console, all the solutions that you will get are the ‘PlayCanvas’ way and therefore the tutorials and docs all apply. The only thing that you are not doing is using the script component system.
Here is the updated external asset load project I did before with the callback for knowing when the model has finished loaded: https://playcanvas.com/editor/scene/547080