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 does it work ?

The Highlight Manager is an independent framework designed to manage multiple highlights at the same time. Every Highlight can be customized.

Highlight Cycle

The HighlightManager will register every Highlight in the scene provied they all have a unique Id.

When the StartHighlight method is called, the Manager clones the Highlight component and its serialized fields to the targetted GameObject.

A GameObject can have multiple Highlights enabled at the same time. Note that the highlights with the higher priority on the GameObject will be on while highlights with lower priorities will stay off until the higher priorities highlights are stopped.

Prepare your scene

First, you need to put the HighlightManager in your scene. Use the provided prefab or add the HighlightManager component to a GameObject.

HighlightManager

You can register highlights by adding their corresponding comoponents in the scene. These components will be used as templates and should be disabled by default.

You can create variants of an highlight with different parameters by adding as many components in the scene as needed and setting a different and unique Id to each of them.

Start and stop highlights through scripting

The Highlight Manager can start and stop highlights in various ways:

1- StartHighlight on one or multiple GameObjects

public void StartHighlight(GameObject gameObject, Highlight highlight)
public void StartHighlight(GameObject gameObjectToHighlight, string idHighlight)
public void StartHighlight(List<GameObject> gameObjects, Highlight highlight)
public void StartHighlight(List<GameObject> gameObjects, string idHighlight)

2- StopHighlight on one or multiple GameObjects.

public void StopHighlight(GameObject gameoBject, Highlight Highlight, bool force = false)
public void StopHighlight(GameObject gameObject, string idHighlight, bool force = false)
public void StopHighlight(List<GameObject> gameObjects, Highlight highlight, bool force = false)
public void StopHighlight(List<GameObject> gameObjects, string idHighlight, bool force = false)

The Highlight Manager keeps track of how many times an highlight has been started on each GameObject. It means that if you start the same highlight on the same GameObject twice, you will need (in order to disable the highlight) to either :

  • Stop the highlight twice
  • Stop the highlight with the force parameter set to true

How to create a custom Highlight

While we provide the Highlight Manager with several Highlights (see the Libraries folder), it is possible to create custom Highlights. These need to inherit from the Highlight class (which inherits from MonoBehaviour).

The HighlightChildObjects field should be taken into account when an highlight might need to apply to multiple Components (for example when a GameObject is composed of multiple meshes).

When starting, Highlights will run the OnEnable() Unity method.

When stopping, Highlights will run the OnDisable() Unity method.

All other Unity component methods can be implemented if needed (for example, use the Update() if the highlight must update each frame).

INSA     IRISA     Inria     Ouest Valorisation Back to top