You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// When remote debugging is enabled, JavaScript runs on the debugging host machine, not on the device where the app is running.
17
+
// JSI (which Babylon Native uses heavily) can not work in this mode. In the future, this debugging mode will be phased out as it is incompatible with TurboModules for the same reason.
18
+
returnfalse;
19
+
}else{
20
+
// This does the first stage of Babylon Native initialization, including creating the BabylonNative JSI object.
// These are errors that are normally thrown by WebXR's requestSession, so we should throw the same errors under similar circumstances so app code can be written the same for browser or native.
// NOTE: Do not use setEngine with a callback to dispose the engine instance as that callback does not get called during component unmount when compiled in release.
83
-
if(engine){
84
-
DisposeEngine(engine);
85
-
}
86
-
// Ideally we would always do a reset here as we don't want different behavior between debug and release. Unfortunately, fast refresh has some strange behavior that
87
-
// makes it quite difficult to get this to work correctly (e.g. it re-runs previous useEffect instances, which means it can try to use Babylon Native in a de-initialized state).
// Not all platforms need this, but for those that do, this is intended to be a synchronous call to boostrap the ability to run native code on the JavaScript thread.
// This waits Graphics/NativeEngine to be created (which in turn makes the whenGraphicsReady available).
31
+
awaitBabylonNative.initializationPromise;
32
+
33
+
// Check for cancellation.
34
+
if(abortSignal.aborted){
35
+
returnnull;
36
+
}
37
+
38
+
// This waits for the Graphics system to be up and running.
39
+
await_native.whenGraphicsReady();
40
+
41
+
// Check for cancellation.
42
+
if(abortSignal.aborted){
43
+
returnnull;
44
+
}
45
+
46
+
returnnewReactNativeEngine();
47
+
}
48
+
49
+
publicgetisDisposed(){
50
+
returnthis._isDisposed;
51
+
}
52
+
53
+
publicdispose(): void{
54
+
if(!this.isDisposed){
55
+
super.dispose();
56
+
57
+
// Ideally we would always do a reset here as we don't want different behavior between debug and release. Unfortunately, fast refresh has some strange behavior that
58
+
// makes it quite difficult to get this to work correctly (e.g. it re-runs previous useEffect instances, which means it can try to use Babylon Native in a de-initialized state).
0 commit comments