How to remove warnings from lastValue in SparkAR

237 Views Asked by At

In a SparkAR script, I use star.transform.z.lastValue to get the actual number. I want to do some math with the numbers, not with ScalarSignals (observable values). Now by doing so, I get lots of warnings: SparkAR console warnings

This API is deprecated, please update to the newest SDK version. 
Please use pinLastValue() instead to receive a ConstSignal as a replacement for lastValue

I don't see what ConstSignal is or how to extract the value from it, since the documentation seems to be lacking: https://sparkar.facebook.com/ar-studio/search/ConstSignal I tried doing figure out what kind of fields/functions it has with reflection, but reflection doesn't seem to work in SparkAR, and I don't have code completion on it either. So I have no idea how to resolve this. Everything works fine when I'm just using lastValue, but I'd love to have a clean console.

Note: I am using Spark AR Studio v96

1

There are 1 best solutions below

2
On BEST ANSWER

Use star.transform.z.pinLastValue() to instead.