Page 1 of 1

Babylon.js

Posted: Tue Jan 13, 2026 5:13 pm
by falsam
Hello,
I am trying to integrate Babylon.js, but I get the following message:
C:\SpiderBasic Project\Babylon\test.sb:7 BABYLON is not defined
■ Small test code to initialize the 3D engine.

Code: Select all

HeaderSection
<meta name="description" content="babylon.js">
<script src="https://cdn.babylonjs.com/babylon.js"></script>
<canvas id="renderCanvas"></canvas>
EndHeaderSection

EnableJS
const canvas = document.getElementById('renderCanvas');
console.log(canvas);

const engine = new BABYLON.Engine(canvas);
console.log(engine);
DisableJS

Thank for your help 🙏🌞

Re: Babylon.js

Posted: Wed Jan 14, 2026 8:23 am
by Dirk Geppert
Unfortunately, HeaderSection inserts the code at the end of the head section.
For this to work correctly, you need the HtmlPreprocessor.

Code: Select all

HeaderSection
  <canvas id="renderCanvas"></canvas>
EndHeaderSection

;!  <HtmlPreprocessor>
;!    [
;!      {
;!        "search": "</title>",
;!        "replace": "</title>\n\n<meta name=\"description\" content=\"babylon.js\">\n<script src=\"https://cdn.babylonjs.com/babylon.js\"></script>"
;!      }
;!    ]
;!  </HtmlPreprocessor>

EnableJS
const canvas = document.getElementById('renderCanvas');
console.log(canvas);

const engine = new BABYLON.Engine(canvas);
console.log(engine);
DisableJS