INSA
  • Tutorials
  • Documentation
  • Api Documentation
  • Changelog
Show / Hide Table of Contents
  • Getting Started
    • Quickstart
  • Unity tutorial
    • Introduction
    • Time for practice
    • Restricted scenario by script?
    • How to create the tutorial scene?
  • Scenario
    • How to create a sensor?
    • How to create an effector?
    • How to setup the engine?
    • How to edit a scenario?
    • How to run a scenario?
    • How to?
  • Relation engine
    • How to create a type?
    • How to create a relation?
    • What are queries? How do queries work?
    • How to be notified when a relation is executed?
  • Highlight Manager
    • How to create a Highlight?

How to run a scenario in Unity

The base class to run a scenario in Unity is the ScenarioRunner component. You can define whether the scenario will run in a separate thread or directly in the unity thread. Additionnaly the maximum time to wait between 2 scenario updates can also be customized. You can inherit from ScenarioRunner to create custom components that should run a scenario. This use-case can be interesting when handling an object state through a state machine

There are 3 specific ways to run a scenario in Unity beside using the ScenarioRunner component:

The Scenario Engine

The ScenarioEngine component, with the Scenario EngineKernel component are meant to run the main scenario of your application while other scenario runners are supposed to run secondary scenarios

Type with Scenario

If you need to run a scenario and link it with a Xareus Type (attached to a Xareus Object), the TypeWithScenario component will handle the ScenarioRunner component it is linked to.

Decision Tree Evaluation

This component is an helper to handle Decision Trees. It contains a simple Evaluate() method to run the decision tree and return the IContext instance containing any information set by the decision tree during the evaluation

INSA     IRISA     Inria     Ouest Valorisation Back to top