No ISceneCamera in GUISceneView.OnRender
by Doug Barnes · in Torque X 2D · 10/22/2007 (7:34 am) · 5 replies
Hello,
When I run my code it builds fine but then it quits out saying that "GUISceneView.OnRender - No ISceneCamera object found: cannot view a scene without a camera!" Any help on fixing this error would be greatly appreciated.
When I run my code it builds fine but then it quits out saying that "GUISceneView.OnRender - No ISceneCamera object found: cannot view a scene without a camera!" Any help on fixing this error would be greatly appreciated.
About the author
#2
10/22/2007 (11:14 am)
Hey thanks for the quick response unfortunately that doesn't seem to be the answer to my problem. See I receive the error well before I ever call the play screen. I actually get the error just after I call the BeginRun() function. If you have any more ideas or need more information just let me know.
#3
1. Have you created your own play screen?
2. Do you have other screens that are displayed first (splash screen/menu/etc)?
3. Are you switching to the play screen before you load the scene?
*Actually, #3 might be most important. A camera is defined within the .txscene file, so if you are trying to call:
BEFORE calling
You might get this problem. Try to make sure you are loading the .txscene file before you switch the canvas over to your play screen.
John K.
10/22/2007 (12:35 pm)
It looks like I'm going to need a lot more details... 1. Have you created your own play screen?
2. Do you have other screens that are displayed first (splash screen/menu/etc)?
3. Are you switching to the play screen before you load the scene?
*Actually, #3 might be most important. A camera is defined within the .txscene file, so if you are trying to call:
GUICanvas.Instance.SetContentControl(GuiPlay);
BEFORE calling
StarterGame.Game.Instance.SceneLoader.Load(@"data\levels\levelData.txscene");
You might get this problem. Try to make sure you are loading the .txscene file before you switch the canvas over to your play screen.
John K.
#4
10/22/2007 (1:25 pm)
No I am definitely calling to load the level before I go to the play screen so thats not the problem. So here are the answers, Yes I have created my own play screen, yes I have other screens that I call fist including a splash screen and a main menu, no I am calling to load the screen before I play it. Again thanks for the help I have been stuck on this for about two days.
#5
i get this error with the templates of version 3.1.4.0 without making any changes to them
the problem is that in the file GUISceneView.cs after
12/05/2009 (12:29 am)
just a heads up - this same problem is beeing discussed in this thread without an answer so fari get this error with the templates of version 3.1.4.0 without making any changes to them
the problem is that in the file GUISceneView.cs after
if (_sceneCamera == null)
_sceneCamera = TorqueObjectDatabase.Instance.FindObject<ISceneCamera>();_sceneCamera remains null
Associate John Kanalakis
EnvyGames
I'm assuming this assert pops up just after loading a scene file. If so, you can try something like this... Go into Torque X Builder. Make sure nothing is selected. Go to the Edit tab. In the Camera rollout, enter a name, such as, "GameCamera". Then save the scene. Next, edit your GuiSceneview-derrived class constructor and add the following (in bold) to the bottom.
public GuiPlay() { // create the Style for our play screen GUIStyle playStyle = new GUIStyle(); playStyle.Anchor = AnchorFlags.All; // set properties for this screen Name = "GuiPlay"; Style = playStyle; Size = new SizeF(800, 600); Position = new Vector2(0, 0); // manually attach the level's camera object to this screen [b]Camera = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("GameCamera");[/b] }This might not be what you're looking for, but it could point you in the right direction. Again, the assert just indicates that the scene view can't render your level because it can't find a camera. A new game project with no screen changes comes with a camera already attached. If you've changed screens around, then that setup is gone.
John K.