Game Development Community

[Resolved...My error :) ]Futuristic Strategy Tutorial : TorqueObjectDatabase is empty?

by Charlie Talley · in Torque X 2D · 08/02/2009 (10:57 pm) · 0 replies

I'm currently going through the Futuristic Strategy Tutorial, and the code :

protected T2DSceneObject _GetUnit(Vector2 location, TorqueObjectType unitType)
{
List<ISceneContainerObject> foundObjects = new List<ISceneContainerObject>();
T2DSceneGraph sceneGraph =
TorqueObjectDatabase.Instance.FindObject<T2DSceneGraph>("DefaultSceneGraph");
sceneGraph.FindObjects(location, 1.0f, unitType, 0xFFFFFFFF, foundObjects);


if (foundObjects.Count == 1)
return foundObjects[0] as T2DSceneObject;
else
return null;
}

Doesn't seem to work. At first it seemed like the sceneGraph was empty, but after a little digging
turns out that TorqueObjectDatabase.Instance has nothing in it's database. Counts are 0. Am
I doing something wrong? I'm pretty sure I followed the tutorial perfectly up to this point. When
I debug the game, the grid, selector, and goodBattleship all show up on the screen, so they have to
be registered in the game somewhere.


EDIT : Sorry, it seems I had forgotten set up my object types...that's why I couldn't find anything in
the database...