I am trying to access a 2D text object with the findfirst function and it was working in the previous update (Version: 97), but in the new update (Version: 98.0.0.17.243 (248298637)) it throws the following error:
JavaScript error: Unexpeted SceneObject reference:
{"identifier":"2_d_text_mode74846-11e77cda-9218-4c2f-871d-
6f0d38749752", "name":"ApplyName1","materialIdentifier":"",
"className":"planarText","modelId":3715}
no stack
I have updated the Spark AR just this morning so it was really strange that we got this error. We also looked at the documentation and implemented the example:
https://sparkar.facebook.com/ar-studio/learn/scripting/adding-physics-to-your-effects#The-script%5C
After implementing the example we found that this error only occurs when we are trying to find a 2d text object.
This is the script used in our game:
let text;
Promise.all([
Scene.root.findFirst('2dText0')
]).then(function (objects) {
text = objects[0];
}).catch((error) => Diagnostics.log(error));
Can someone help us, or does someone know the answer to this problem? We posted this question to the Spark AR forums as well to get an answer, but we're also reporting this to facebook a.k.a. the Spark AR bug report system.
Version: 98.0.0.17.243 (248298637) OS: Windows
EDIT: JUMP FROM V97 TO V100. They have fixed the problem with Scene.root.findFirst
OLD: I've the same problem in v98... "text" class is broken. I've reported this bug, please write in SparkARCommunity on fb:
".text" in 4th line is the problem, it's broken.
Anyway the only solution is to "play" with: Patches.outputs.setString('varFromScript',value) / Patches.inputs.getString('toScript'). I'm awaiting a fix or some news from Spark AR team or I'll be forced to replace my hard code...