Hi there,
I am actually working on a project where i got to send data from web page to playcanvas iframe.
Actually, i can send data from web page and receive it on playcanvas iframe.
But, in my receive function, i can’t call a function of my script … I think i juste forgot a stupid thing but i don’t see what
That’s my code :
GameController.prototype.update = function(dt) {
window.onmessage = function(e) {
var dataReceive = e.data;
console.log(dataReceive);
this.startGame(dataReceive);
};
};
GameController.prototype.startGame = function(scenario) {
console.log("Start");
};
And i got this error : Uncaught TypeError: this.startGame is not a function
at window.onmessage (__game-scripts.js:1:25781)
edit : i can see in console my data (line 4)
Anyone can help me ?
Thanks !