Game Development Community

Error with starter game (tx2d 3.0)

by Gavin Beard · in Torque X 2D · 05/16/2009 (1:06 pm) · 5 replies

Hi all,

I have created a Torquex 2D project, using tx3.0 and visual studio 2008. I have made no adjustments to the default starter game and it compiles fine, if Ii try to run it I get a NullReferenceException was unhandled error at Line 112 (_sceneCamera.SceneGraph.Camera = _sceneCamera;) in GUISceneview.cs.

It would seem from some reason_sceneCamera is always null, I have had a flick through the code but cant figure it, is anyone else getting this, and does anyone know how i can fix it?

Cheers

*EDIT
Also when compiling i get 395 warnings, things like -
C:UsersgavinDocumentsVisual Studio 2008ProjectstbsTesttbsTestTorque2DT2DComponentsT2DCollisionComponent.cs(1010,54): warning CS1591: Missing XML comment for publicly visible type or member 'GarageGames.Torque.T2D.T2DCollisionComponent._containerQueryResults'

all of them seem to be these xml errors, is this normal?

*edit 2 - now, after paying out a bit I'm getting error GUISceneView.OnRender = No ISceneCamera object found: cannot view a scene whitout a camera!

I'm not able to find out how to add a camera, any suggestions :-)

#1
12/03/2009 (6:49 pm)
have the same issue - only 7 warnings though - version 3.1.4
#2
12/04/2009 (12:04 pm)
Hm, not sure. I think I saw this problem a long time ago too. Did you try to manually add a camera to your txscene? Something like:

<Camera2D name="Camera">
            <CenterPosition>
                <X>0</X>
                <Y>0</Y>
            </CenterPosition>
            <Extent>
                <X>1280</X>
                <Y>720</Y>
            </Extent>
            <UseCameraWorldLimits>false</UseCameraWorldLimits>
        </Camera2D>
#3
12/04/2009 (2:00 pm)
there is already such entry in the txscene file

only diference is it has
<ResizeToDisplayAspectRatioWithFixedWidth>true</ResizeToDisplayAspectRatioWithFixedWidth>

istead of
<UseCameraWorldLimits>false</UseCameraWorldLimits>

i tried changing it to yours and having both entries - still no ISceneCamera

the problem is that in the file GUISceneview.cs after
if (_sceneCamera == null)
      _sceneCamera = TorqueObjectDatabase.Instance.FindObject<ISceneCamera>();
_sceneCamera remains null
#4
12/04/2009 (6:52 pm)
Try changing to
T2DSceneCamera camera = TorqueObjectDatabase.Instance.FindObject<T2DSceneCamera>("Camera");

You may also need to name your camera "Camera" in your level, although I think I read somewhere that the camera name doesn't really matter and it is always named "Camera." I could be wrong on that point though.
#5
12/04/2009 (7:12 pm)
wouldn't that mean changing a lot on the engine itself since everywhere in the engine the camera is addressed using the _sceneCamera variable wich is defined in GUISceneView.cs as
ISceneCamera _sceneCamera = null;