This module allows you to display or hide elements of the GraphicEntityModule using the viewer's options menu. This can help to create debug modes.


⚠ This module requires the GraphicEntityModule to work.

Add the dependency in the pom.xml of your project.


And setup the module and the toggles in your config.js.

import { GraphicEntityModule } from './entity-module/GraphicEntityModule.js'
import { ToggleModule } from './toggle-module/ToggleModule.js'

// List of viewer modules that you want to use in your game
export const modules = [

// The list of toggles displayed in the options of the viewer
export const options = [
    // The name of the toggle
    // replace "myToggle" by the name of the toggle you want to use
    toggle: 'myToggle',
    // The text displayed over the toggle
    title: 'MY TOGGLE',
    // The labels for the on/off states of your toggle
    values: {
      'TOGGLED ON': true,
      'TOGGLED OFF': false
    // Default value of your toggle
    default: true
    toggle: 'myOtherToggle',


@Inject ToggleModule toggleModule;

public void init() {
  // Only display `myEntity` when the state of `myToggle` is `true`
  toggleModule.displayOnToggleState(myEntity, "myToggle", true);
  // My entity will only be displayed when `myToggle` is true 
  // (on the `TOGGLED ON` position according to our previous setup)
Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to