ES6 Tree Shaking Side Effect for ActionManager

Hello together,
I am struggling to use ActionManager/ExecuteCode action in an application that makes use of tree shaking. When I import the ActionManager/Execute-Code action like this, everything works:

import { ExecuteCodeAction } from '@babylonjs/core';

As soon as I rework all my imports like this:

import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions';

the ActionManager is no longer working, although no error messages are thrown.

I guess I miss some side effect import that I was so far unable to find. Does anyone know which side effect import I am missing?

Best regards,
Axel

For example:

import { ActionManager } from '@babylonjs/core/Actions/'
import { ExecuteCodeAction } from '@babylonjs/core/Actions/directActions'
import { InterpolateValueAction } from '@babylonjs/core/Actions/interpolateValueAction'

Usage example (for your application you may need another action than InterpolateValueAction, in import as well)

        sphere.actionManager = new ActionManager(this._scene)

        sphere.actionManager.registerAction(
            new InterpolateValueAction(
                ActionManager.OnPickTrigger,
                sphere.material,
                'emissiveColor',
                Color3.Green(),
                3000
            )
        )
3 Likes

Hi,
thanks for your answer. In the meantime, I found a solution: In order to enable picking with ES6 tree shaking, you have to import this side effect:

import '@babylonjs/core/Culling/ray';
2 Likes