Hello everybody, my build was going quite ok, but one error in the unifiedSpawn script is frozen the entire playcanvas, and i have to close all the windows and restart playcanvas everytime. I have nailed down the problem to be in the unfiedSpanner script, in the launchWave function at the very begning. If I take those lignes out, I can launch, I have no idea of what is goint on here is the project : https://playcanvas.com/project/1332209/overview/jeu-des-relatifs-222
here are the Devil’s lines :
this.isSpawning = true;
this.spawnedShips = [ ];
let a = pc.math.random(-16, 16) | 0;
let b = pc.math.random(-16, 16) | 0;
let result;
let valid = false;
const types = ['addition_meme', 'addition_oppose', 'soustraction_meme', 'soustraction_oppose'];
const missionType = types[Math.floor(Math.random() * types.length)];
if (a !== 0 && b !== 0) {
const sameSign = (a * b > 0);
const expectedSame = missionType.endsWith('meme');
const opAdd = missionType.startsWith('addition');
if (sameSign === expectedSame) {
result = opAdd ? a + b : a - b;
if (result >= -31 && result <= 31) {
valid = true;
}
}
}
what do you think about that?