"Element is already the child of another element" Error

Dec 2, 2010 at 1:56 AM


I'm trying to add several 3D models, all the same model, to my scene. The number of 3D models will be dynamic. All the objects are the same but will have independent positions that will change during the lifetime of my app.

So i try to use a List<Mesh> to handle my problem, so i do some like these:




where _placas are a List<Mesh>.

When I try to compile I have the problem "Element is already the child of another element." 

When I do


Mesh placa1 = ContentManager.Load<Mesh>("placa.ase");
Mesh placa2 = ContentManager.Load<Mesh>("placa.ase");

its all ok. 


What wrong with the first snipe of code?

Dec 7, 2010 at 8:16 PM

That seems really odd.  I don't see anything wrong with your code. 

What if you try something like this : 

var placa = ContentManager.Load<Mesh>("placa.ase"));


Dec 9, 2010 at 2:34 PM

Its works, using var placa instead Mesh placa... Is odd. Now the objects are blinking. Its normal?

Dec 9, 2010 at 7:58 PM

Blinking.. That sounds odd - is it possible for you to send me the project?  email : einar [at] dolittle [dot] com