Editor's Canvas getContext("2d") returns null

I’m writing a custom script using Editor API. Noticed that Editor’s Canvas getContext(“2d”) returns null. Is there any other way to get the context?

Here is my code:
var canvas = document.getElementById("canvas-3d");
canvas.getContext("2d") //Returns null

I need to use function cxt.drawImage(img, 0, 0, canvas.width, canvas.height);

As the canvas is currently being used for WebGL, you cannot get another context from it: javascript - How to use multiple canvas contexts? - Stack Overflow

1 Like