I noticed that the Entity.Destroy() function from class Entity doesn't destroy a metal window bar that is attached to a wooden/metal window. Is there anyone els that experienced the same problem? I have only noticed this problem with the Gameobject metal window bar.
for my remover tool i use:
to remove the structure/deployable.
I have tried the following code aswell, but i won't remove the metal window bar
Solved - See the comment section below
for my remover tool i use:
C#:
hurtevent.Entity.Destroy();
I have tried the following code aswell, but i won't remove the metal window bar
C#:
if (hurtEvent.Entity.IsDeployableObject())
{
DeployableObject deployableObject = (DeployableObject)hurtEvent.Entity.Object;
TakeDamage.KillSelf(deployableObject.GetComponent<IDMain>());
}
if (hurtEvent.Entity.IsStructure())
{
StructureComponent structureObject = (StructureComponent)hurtEvent.Entity.Object;
TakeDamage.KillSelf(structureObject.GetComponent<IDMain>());
}
Last edited: