Home
  • Manual
  • Node Index
  • API
  • Changelog
Search Results for

    Show / Hide Table of Contents
    • Tutorials
      • Creating your first map generator
        • 1. Creating your first map graph
        • 2. Running a graph at runtime
        • 3. Adding more nodes
        • 4. Object placement
      • Basic map types
        • • Cave-like maps
        • • Room-based maps
        • • Sample-based maps
        • • Combining map types
      • More Tutorials
        • • Generating prefabs
        • • Tile/prefab/tilemap set weights
        • • Syncing named color sets
        • • Groups
        • • Notes & comments
        • • Sub graphs
        • • Tilemap Sets
        • • Optimization tips
        • • Static seed (daily challenges)
        • • Running a graph asynchronously or multi-threaded
        • • Object pooling
        • • Tips for rule tiles
        • • Saving and loading maps
      • Tutorials for coders
        • • Running graphs from scripts
        • • Output parameters
        • • Custom nodes
        • • Custom node views
        • • Adding a constant node type
        • • Custom styling for the graph editor
        • • Dependencies for custom nodes
    • Sample Project
    • Troubleshooting
    • Support

    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[];
        }
    }
    

    Monitoring the output

    The Map Graph Runner component has an "Output Parameters" foldout. Here you can see the output for each parameter for the last time the graph was run.

    Monitor Output

    In This Article
    Back to top Generated by DocFX