Load Multiple Scene Files .txscene [SOLVED]
by Aaron Scovel · in Torque X 2D · 06/28/2011 (1:33 pm) · 2 replies
I use to be able load a second txscene and have it appear above the the previous txscene (overlay / pause menu / etc), but for the last few days I've been pulling my hair out to achieve this with no luck. The working demo's I had previously made to showcase this feature got lost during my hd failure a while back.
I'm using CEV4
Basically after loading the first scene I load another .txscene file
Am I missing a crucial step?
Debug shows the scene being loaded and the objects are registered. I can manipulate the scene objects, change position, layer, visibility, etc, but no matter what, they're not actually visible. I have also disabled collision just to make sure.
I know it can be done (or use to) - Here is a link showing others doing this.
I'm using CEV4
Basically after loading the first scene I load another .txscene file
Game.Instance.SceneLoader.Load(@"datalevelsoverlay.txscene");
Am I missing a crucial step?
Debug shows the scene being loaded and the objects are registered. I can manipulate the scene objects, change position, layer, visibility, etc, but no matter what, they're not actually visible. I have also disabled collision just to make sure.
I know it can be done (or use to) - Here is a link showing others doing this.
About the author
Previously a PHP/MySQL Programmer/Web Developer of 10 years. In Aug 2010 I decided to change careers, and this is were I landed! I also parent 3 kids full time. TopNotched.com
#2
06/29/2011 (5:04 pm)
This code supplied by Will O'Reagan fixed the problem. Thanks Will!static public void setToSceneGraph()
{
T2DSceneGraph graph = new T2DSceneGraph(); ;
foreach (T2DSceneCamera _cam in TorqueObjectDatabase.Instance.FindObjects<T2DSceneCamera>())
{
T2DSceneCamera temp = _cam;
if (_cam.SceneGraph.Folder != null)
{
graph = _cam.SceneGraph as T2DSceneGraph;
break;
}
}
foreach (ISceneObject2D obj in TorqueObjectDatabase.Instance.FindObjects<ISceneObject2D>())
{
obj.SceneGraph = graph;
}
foreach (T2DSceneGraph _graph in TorqueObjectDatabase.Instance.FindObjects<T2DSceneGraph>())
{
if (_graph != graph)
_graph.MarkForDelete = true;
}
}SceneLoader.Load(@"data\levels\Diamonds.txscene"); // visible SceneLoader.Load(@"data\levels\level.txscene"); // visible setToSceneGraph() // Call this after each scene load
Torque 3D Owner Aaron Scovel
I don't remember having this issue last time I achieved this
I could really use some help with this guys, Ive spent almost 3 full days with no luck.