c2_callFunction, c3_callFunction and minification

  • Ashley

    I have a plugin that uses c2_callFunction and c3_callFunction in its source code. When I export the project with "minify script" option enabled, it seems to minify c2_callFunction and c3_callFunction to something like "g_zu" which ends up being undefined.

    Am I doing it wrong? Is it a bug? Is it by design?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's defined in c2 as window["c2_callFunction"]. C3 is probably defined the same way.

    So if you're calling it from a plugin and want it to be minify safe use:

    window["c2_callFunction"]("my function",[])

    instead of

    c2_callFunction("my function",[])

  • It's defined in c2 as window["c2_callFunction"]. C3 is probably defined the same way.

    So if you're calling it from a plugin and want it to be minify safe use:

    window["c2_callFunction"]("my function",[])

    instead of

    c2_callFunction("my function",[])

    Hmm... is window.c2_callFunction also fine then?

  • That would still minify in your plugin and not work.

    The way c2_callFunction is defined it's name will not be minified. That doesn't stop the minifier from minifying the name as you're calling it in your plugin though. Basically you use object["name"] instead of object.name to keep "name" from being minified.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)