How do I compile Babylon.js project into Iphone app?

Hello dudes,

how can I compile a program in Babylon.js into Iphone format? I want to run the program not in a browser but as an iphone application. Is tehre a way how to do it? Is there any instructions, or better tutorial for this? I searched the internet for information but did not find real tutorial. thanks for explaining in advance.

So for most web frameworks it would be pretty hard but fortunately, despite being still early maybe what you are looking into is babylon native :slight_smile:

Let me add @bghgary and @Cedric who can provide more info on this front.

1 Like

GitHub: GitHub - BabylonJS/BabylonNative: Build cross-platform native applications with the power of the Babylon.js JavaScript framework

That should give you an idea hopefully.


Thanks for your answer. Link number one is going to the Babylon.js native promotional page. Something about multiplatformity… For more information, see the babylon.js forum and friendly community(important note :D). See link 2 for more information. A) you can download babylon.js native. But there is no executable file anywhere. Is CMake likely to build it? I tried to use cmake-gui.exe, but I got a compilation error. From the materials I still do not understand the philosophy of workflow, operation, assembly…Why should I use some other external programs like CMake?

Babylon Native does not have a prebuilt executable as it’s a library intended to be integrated into an executable. It’s up to you how to do that. You need to build it yourself using the instructions from the readme.

Perhaps this is not what you are looking for? Maybe you are looking for progressive web apps?

1 Like

Thanks for next info. I will read more about it then I can make more concrete question.

1 Like

You could also look at some tools like Cordova or Ionic but a PWA is a much easier option.

Holy Crap Nuts :slight_smile:

i just really taking a look at this and the native project… And Holy Crap Nuts :slight_smile:

Yo @bghgary … You know i gonna have a few questions about how to actually implement a project in BabylonNative.

First of all, from what i can tell the KEY native code that really does everything is the Babylon::ScriptLoader class. This looks like some kind of encapsulated V8 Javascript Engine for Babylon.js runtime (basically any javascript is looks like ???). You can eval script right into the runtime loader or actually LoadScript using the app:// protocol.

Thats really it… all it does from a native host application point of view (besides some native input manager pointer stuff).

The fact that is render scene content or loading gltf scene files is because one of the loaded javascript files is using babylon javascript to create a scene and optionally append gltf scene content… And script code starts the engine render loop… basically the same kind of shit you would do in Babylon Playground… Again… Holy Crap Nuts :slight_smile:


1… Should i be able to run my SceneManager extension that registers its GLTF Loader so my Unity GLTF Parsing that i use in a regular babylon.js environment (provided I remove all the HTML DOM stuff)

2… Does console.log and console.warn work in BabylonNative ???

3… Does GLTF PBR Materials and shaders work… Basically can i still use PBRCustomMaterial the way i do in a regular babylon.js environment ???

4… Does babylon.gui.js work ???

Am i on the right track ???


Yes, once everything is in place. There will be bugs. :slight_smile:

Yes. Though all it does right now is log to the debug output in the examples. This can be replaced to anything you want.

Yes, once all the shader processing issues are resolved. We haven’t tested PBRCustomMaterials yet, but it should work.

3D GUI should work barring font rendering which we are eventually going to do, but it’s not there right now. 2D GUI uses HTML, so that’s not in scope.


How do you specify what javascript you want available ??

Cant tell how it knows what script files to package up that will be available via the app:// protocol ???

The ScriptLoader is intended help with this. Call ScriptLoader::LoadScript to load scripts in order. The contract for this class is not fully baked yet as it behaves a bit strange in some situation, but it should work for simple cases.

This is up to the app. Babylon Native is currently a static library. The app consuming Babylon Native is responsible for how the package is built. The app:/// protocol will get the file inside the app package. It is different depending on which platform. Android uses AAssetManager. iOS/macOS uses [NSBundle mainBundle]. Window UWP uses ApplicationModel::Package::Current().InstalledLocation().GetFileAsync. WIN32 currently doesn’t support app:/// protocol, but maybe it can load from the executable path. This part certainly can use some documentation. :slight_smile:


Is there a way to load scripts from Javascript? (on the web, I’d just append a script tag to the DOM). So, for example, is loadScript exposed somehow? I admit that for debugging, being able to set up the app to dump and reload the scripts without rebuilding would be nice.

What about debugging? Can I point a web browser debugger at this somehow?

@bghgary, @Cedric and @syntheticmagus are our best bet on this front :slight_smile:

The contract for this is not stable yet, but you can right now use BABYLON.Tools.LoadScript to do it (assuming you have Babylon.js already loaded). We are considering removing the C++ ScriptLoader contract and replacing it with something in JavaScript.

For HL2, this isn’t possible yet. We are investigating enabling Chrome DevTools for V8 when targeting HL2. If you are using Chakra and running on desktop, you can debug the JavaScript by using Visual Studio. Note that you can’t debug both C++ and JavaScript with one instance of Visual Studio. You can however debug both at the same time with two instances of VS.

Sorry for multiple messages. :slight_smile: We have a keyboard shortcut (‘R’) set up to reload the scripts in the sample playground app. This isn’t super easy to do with HL2, but it’s possible.

Thanks for all the replies @bghgary … you’re making me remember why I hated doing native, non-web apps (ugh, Unity) on mobile devices. :laughing:

Now that I have it working, these are all useful things to know and think about. I was mostly investigating for some colleagues who are wanting a web-based AR system on H2, and this seems feasible until/if the Hololens team gets a browser up with WebXR


I know what you mean. :slightly_smiling_face: We will make this experience better for HL2. It’s not quite there yet right now.