0

I'm working on a game using spark ar, by following the tutorial from youtube (blinking game tutorial). apparently when I was working there was an error in the script

    const Scene = require('Scene');
    export const Diagnostics = require('Diagnostics');
    const Patches = require("Patches");

    Promise.all([
        Scene.root.findFirst('number'),]).then(onReady);

    function onReady(assets) {
      var counterNumber = assets[0];
      var scoreNumber = p.outputs.getScalar("score");

      scoreNumber.then(e => {
        e.monitor().subscribe(value => {
          counterNumber.text = value.newValue.toString();
        });
      });
    }

Error : Possible Unhandled Promise Rejection: ReferenceError: Property 'p' doesn't exist

Vinicius
  • 1,060
  • 1
  • 12
  • 21
Hafid Suhanizar
  • 89
  • 1
  • 1
  • 7

2 Answers2

2

create a const P as below and check whether its working or not

const Scene = require('Scene');
const P = require('Patches');

reference taken from Score Didnt show up (Spark AR)

shotgun02
  • 756
  • 4
  • 14
0

the problem is on this line :

var scoreNumber = p.outputs.getScalar("score");

"p" is not defined anywhere in your entire code that's why it is throwing error

Hammad Ahmed khan
  • 1,618
  • 7
  • 19