Output parameters
Sometimes you might want to return some generated data other than the actual map. Maybe for your own further processing or debugging purposes. You can use output parameters for this.
You can add output parameters to your graph in the exact same way as you'd add input parameters. If you need a reminder on how to do this, you can check out this tutorial.
Once you've added your parameter you can find it in the editor, by right-clicking empty space, under Output.
Here's an example of how to retrieve the results in a script.
using System.Collections.Generic;
using InsaneScatterbrain.ScriptGraph;
using UnityEngine;
public class GetOutParametersExample : MonoBehaviour
{
[SerializeField] private ScriptGraphRunner scriptGraphRunner;
private void Start()
{
scriptGraphRunner.OnProcessed += Processed;
}
private void Processed(IReadOnlyDictionary<string, object> outputParameters)
{
var enemyPositions = outputParameters["EnemyPositions"] as Vector2Int[];
}
}