Browse Source

Properly destroy brush model child game objects when clearing an entity's model. Fixes explosive barrels not disappearing when blown up.

console
Nico de Poel 5 years ago
parent
commit
3c2ca26a99
  1. 6
      Assets/Scripts/Game/Entity.cs

6
Assets/Scripts/Game/Entity.cs

@ -65,8 +65,10 @@ public class Entity
} }
meshRenderer.enabled = false; meshRenderer.enabled = false;
// TODO: not sure if this is the right way to unlink world sub-models
gameObject.transform.DetachChildren();
for (int child = 0; child < gameObject.transform.childCount; ++child)
{
Object.Destroy(gameObject.transform.GetChild(child).gameObject);
}
} }
public void SetAliasModel(AliasModel model) public void SetAliasModel(AliasModel model)

Loading…
Cancel
Save