Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

spark ar studio - How to solve javascript "Unhandled Promise Rejection" and "Property 'p' doesn't exist" errors?

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

question from:https://stackoverflow.com/questions/65952779/how-to-solve-javascript-unhandled-promise-rejection-and-property-p-doesnt

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...