about dispose

Software: Away3D 4.x

yesbaba, Newbie
Posted: 10 January 2012 07:55 AM   Total Posts: 13

i want to dispose the objectContain3D of the root of the Scene3D,
i met following problem in MaterialLibrary.

arcane function unregisterMaterial(material MaterialBase) : void
  {
   
var [color=red]id[/color] int material.uniqueId;
   
_names[id] null;
   
_materials[id] null;
   
material.setUniqueId(-1);
  

the var id is -1, so i guess this material is also used by other mesh, and it has already been disposed.

so i changed the code to

arcane function unregisterMaterial(material MaterialBase) : void
  {
   
var id int material.uniqueId;
[color=red]   if (id == -1)
    return;
[/color]
   _names[id] 
null;
   
_materials[id] null;
   
material.setUniqueId(-1);
  

no problem occurs.

BTW. would there be a problem if other asset is disposed multiple times?

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X