How to implement a score logic when you have more than two output Values in your Patch Editor?

In the project I am working on I have 10 different output Values which I want to combine all the output Values together into one input as the Total Score.

The Problem:
The Patch Editor has only two input Values that can be sent to a single output. The logic using only the Patch Editor will have you scratching your head to show the total of every output Value into one input.

The Solution:
The solution is to send all the end Values as signal to the script. Then send back the total Value back to the patch with the total score of all the objects combined.

To understand more on how the Spark AR Patch to Script works, click on the following link:


SPARK AR Patch to Script

This example is provided by Andrey Staroseltsev Facebook post that shows how to use the Spark AR Patch to Script editor.

Below are some useful examples :

Patch Editor / JavaScript Interoperability


AR Studio v38 now has an ability to have shared context between the Script and the Patch Editor.

It is now possible to read & write JavaScript signal variables from the Patch Editor and vice versa.



From the Script Inspector of AR Studio it is now possible to declare variables to be used in both Script & the Patch Editor for reading as well as writing.

– “From Script” variables allow to get (read) JS signals inside the Patch Editor by having a Producer patch.
– “To Script” variables allow to set (write) JS signals inside the Patch Editor by having a Consumer patch

Check out a video 🎬 attached to see this in action



Import the newly added Patches module in your script:

var P = require(‘Patches’);

Write to signals:

// Set a signal:
P.setBooleanValue(“boolVar”, boolSignal);
P.setScalarValue(“scaleVar”, scalarSignal);
P.setVectorValue(“vectorVar”, vectorSignal);
P.setPulseValue(“triggerVar”, eventSource);

// Or set a constant:
P.setBooleanValue(“boolVar”, false);
P.setScalarValue(“scaleVar”, 0.75);
P.setVectorValue(“vectorVar”, R.vector(-10, 20, -10));
P.setPulseValue(“triggerVar”, R.once());

Read from signals:

// Get a signal
var boolSignal = P.getBooleanValue(“boolVar”);
var scaleSignal = P.getScalarValue(“scaleVar”);
var vectorSignal = P.getVectorValue(“vectorVar”);
var eventSource = P.getPulseValue(“triggerVar”);

Full module documentation available here:…/api…/classes/patchesmodule

How To Unity 360 Video in 17 Steps

Versions & Packages

This 360 Video is done with the following Unity & Unity Packages Versions.

  • Unity Version 2019.1.1f1
  • Unity Post Processing Version 2.1.7
  • Unity Recorder Version 2.0.1 (Preview)

Synty Studios Sci-Fi City Pack


This prototype is done to test the capabilities and pushing the limits of Unity Recorder that is available in the Package Manager.

Note: This documentation is my own personal preference, you are free to test out other settings that might work with your project.
For more info you can check out Unity Recorder User Manual.


360 Video Settings

1. To download Unity Recorder go to Window > Package Manager
2. Install the Unity Recorder
3. Once installed, go to Window > General > Recorder > Recorder Window
4. Dock the newly opened Recorder Tab
5. In the Recorder Tab, click + Add New Recorders and choose Movie
6. For the Format choose MP4
7. Change the File Name and Path of your choice
8. Change the Capture settings to 360 View
9. For the Source make sure MainCamera is selected
10. For the 360 View Output, change it to 4096(W) x 2048(H)
11. For the Cube Map, set it to 2048
12. Make sure to uncheck Stereo
13. Capture audio can be checked depending on your desired output
14. Quality set to High
15. Press Start Recording
16. Wait for the animation to end and press Stop Recording
17. The output should be where you set as your Path