[Plugin SDK] document not defined in edittime

  • It appears that document is not available in edittime...

    This throws undefined document:

    var canvas2 = document.createElement('canvas')

    Unless there is another way to create an offscreen canvas in edittime, I have no other way of rendering textures outside the existing canvas (for caching, image composition etc.).

    In runtime, document is accessible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This isn't a bug - from the SDK docs:

    ou cannot use browser features in the edittime, since the edittime script is interpreted by Google's V8 javascript engine rather than a real browser.

    'document' is a browser feature, and there is no browser running when running the editor, so you cannot use any browser features at all! It's only the javascript engine, so assume nothing is available except the documented functions.

  • Ah, somehow missed that bit. Fair enough, thanks for prompt answer!

    I was hoping to get some kind of preview for my spritefont plugin, looks like I may have to do it the hard way.

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