I am trying to call a function by registering a pick action then using ExecuteCodeAction. The function call works properly when called from an if, but throws an error when I click on the sphere. Here is the code in playground:
https://www.babylonjs-playground.com/ts.html#V2G1XI#17
The error is
Uncaught TypeError: this.func is not a function
at t.execute (babylon.js:16)
at t.e._executeCurrent (babylon.js:16)
at t.processTrigger (babylon.js:16)
at e._processPointerUp (babylon.js:16)
at babylon.js:16
at e._initClickEvent (babylon.js:16)
at _onPointerUp (babylon.js:16)
Any advice?