For a board game, I have arrays full of positions in space and connections between them, which I would like to make visible. I thought of using “app.renderLine”, which seemed straightforward, but whenever I use it (from the docs), my game doesn’t even load. It throws “Uncaught TypeError: app.renderLine is not a function”.
Am I using renderline at the wrong moment? It’s in the first script of my script priority list…
Looking at your code, I guess you are talking about the file game_noEnt.js?
In which case, the reason for the problem is that app isn’t a global variable so it is undefined when you try and call it. It is available to scripts because of the callback function that passes the function the app.
pc.script.create('scriptname', function (app) { ... });
If you want to use it outside of a playcanvas format script. You can access the current app like this:
var app = pc.Application.getApplication();
This is fine as long as you aren’t running multiple playcanvas applications on the same page which probably won’t be an issue.