Console Error: addToScene() - Object '1234' is already in a SceneGraph!
by Brian Wilson · in Torque Game Builder · 07/03/2011 (1:52 pm) · 5 replies
So every time I spawn an object via:
I get the following console error with each instantiation of an object:
... where 1323 is the object ID that was added.
The object adds in and functions perfectly, but I'm curious about the console error. Any pointers on what's causing this? Or is it just a standard behavior?
Thanks in advance...
%newObject = ObjectTemplate.cloneWithBehaviors(); objectSimSet.add(%newObject);
I get the following console error with each instantiation of an object:
t2dSceneGraph::addToScene() - Object '1323' is already in a SceneGraph!.
... where 1323 is the object ID that was added.
The object adds in and functions perfectly, but I'm curious about the console error. Any pointers on what's causing this? Or is it just a standard behavior?
Thanks in advance...
#2
Perhaps I should use a different method to build objects from a template?
07/04/2011 (12:42 am)
I would normally agree, but the template is just an object I built out of the range of the camera in the GUI. At no point do I add the Template to any SimSet.Perhaps I should use a different method to build objects from a template?
#3
As far as I know, that's the way to do it; although the console spam is annoying.
07/05/2011 (5:52 am)
This has been around as long as I can remember. I do recall seeing a thread about how to fix it (in source) but I couldn't locate it.As far as I know, that's the way to do it; although the console spam is annoying.
#4
1) I'll be spawning thousands of objects in short periods of time, so I'm sure I can get minor performance improvements by fixing it,
2) Because OCD accepts no excuses.
07/05/2011 (7:09 am)
Thanks Patrick. I haven't used the engine in quite some time and didn't recall seeing it before. If this is indeed a minor engine bug, I'll definitely have to do a source mod at some point because: 1) I'll be spawning thousands of objects in short periods of time, so I'm sure I can get minor performance improvements by fixing it,
2) Because OCD accepts no excuses.
#5
Other option is (just a guess) to set cloned object's scenegraph field to "". Even though there appears to be not much use in having this warning, I would prefer to keep it working since it is already there.
07/05/2011 (8:41 am)
There is a nice handy flag you can use to disable these warnings - $pref::T2D::warnSceneOccupancy - it is defined within defaultPrefs.cs .Other option is (just a guess) to set cloned object's scenegraph field to "". Even though there appears to be not much use in having this warning, I would prefer to keep it working since it is already there.
Torque Owner Rpahut
Since it's working fine after that, I assume your ObjectTemplate is in the objectSimSet, so it's clones go there too.