No Active Camera Set for dummy scene

Hey everyone,

I have a dummyScene that just holds some meshes and sounds. I just updated babylonjs to alpha.21 before i did not have a camera on my dummy scene, now i get a runtime error :
Uncaught Error: Active camera not set
at t.a.a.createPickingRayToRef (babylon.js:16)
at babylon.js:16
at t.a.a._internalPick (babylon.js:16)
at t.a.a.pick (babylon.js:16)
at t._initActionManager (babylon.js:16)
at t._initClickEvent (babylon.js:16)
at _onPointerUp (babylon.js:16)

So if i make a dummy camera, this error goes away.
Is there a way around this? I dont need the dummy camera at all. Is there a way to do this without creating another object that wont be used?

research:

This should not happen if you are not attaching controls or trying to render this scene. Calling AttachControl is the only way _onPointerUp would get called.

Would this still be the case in babylon alpha 8 ?

I ask because i have not gotten this error before and had not changed any code between the tests and the updates. So this would seem like an error with one of the two versions.

Let alone as far as i know there are no controls on this scene and im not rendering it. So this is very strange.

Any ideas?

Nothing should have changed here, this is definitely strange would be nice if you could repro in the pg.

I wish i could but this is a large project and making it in the pg would be very difficult :slight_smile:

However i can provide more errors im encountering now…

So here are my guess’ as of now:

I use the dummy scene to preload images, meshes and sounds etc… Then i use some of those images for gui in my real scenes. Maybe something is causing them to not be updated to the new scene.

I also have some home grown babylonjs modules (that i hope someday i can commit to the greater babylon :slight_smile: ) they seem to work but throw compile errors. (Can still run with these…). The one in question being circle button, which is and extension of ellipse…
https://www.babylonjs-playground.com/#EJX0YB#1 (seems to work fine though)

It only happens on pointer up, never anywhere else, not onPointerDown. Which is very strange.

Ok, another very strange thing:

I can console.log(scene) then when i click, the console shows the scene object(and the corresponding error that i put in the initial post). I can then expand it, and expand active camera to show my current camera…

So my current scene that has the onPointerUp has a active camera.

…

This does not happen in babylonjs 4.0.0-alpha.11 - 17

The problem starts on 4.0.0-alpha.18

When was ninepatch support added / finialized?

(thats the main reason im trying to use alpha.21)

I would say around 16 or 17 but not entirely sure
The best way is to repro even if the pg is a bit fat so we can debug and easily find the culprit

Yeah i noticed that ninepatch is on 17, that is good, that it is there before the error one(18).

I will try to get a repro(reproduction right?) however the scale is very large.

For the time we have opted to use 17

1 Like

It seems as though this error is more challenging to suppress than i thought. As i am on version .17, and after switching through scenes, creating, and disposing i get the error again. This could be because of bad logic. However it works perfectly on version 8.

It seems for now i should just stay on 8 as it has no problems, where the only reason i have to update is ninepatch… i could get around it…

Well I would prefer to fix it if the issue is on our end (plus you wont stay on alpha8 forever ;))

Please ping us here when you have a chance to repro (reproduce the bug :slight_smile:

Yeah i was thinking that but for not its just too much to handle. Hopefully we will be able to figure it out.

Could it have anything to do with my assetloader being on the dummy scene, then calling those assets in other scenes? Such as
assetloader loads(sounds, images, textures)(on the dummy scene)
then the image from the dummy scene is used on a regular scenes GUI, with onclick events…

this is the only reason i could think it might be happening.

Just food for thought

Oh yeah that could definitely be the reason!

1 Like

Ok so, long time since ive run into this problem. But ive made this into a tiny playground
https://www.babylonjs-playground.com/#8CC5W7#2

Click the scene and you get the error in the console(developer console). I tried to make this perfect as close as i could get to the original but as small as possible.

So i have a dummy scene that load/ and would regularly store the image asset. Then i use that image asset in the main scene. However i get this error:
“babylon.js:16 Uncaught Error: Active camera not set”
when clicking anywhere in the scene.

Any ideas on how to fix this?

1 Like

Maybe this is a clue to what changed:

1 Like

You should detach your dummy scene from listening to inputs: https://www.babylonjs-playground.com/#8CC5W7#3

2 Likes

hmmmm, not sure i understand this, just noticed i dont use free camera. i use Arc rotate.
Here is a more up to date one.

https://www.babylonjs-playground.com/#8CC5W7#4

il try this!!