playMaker

Author Topic: How do you destroy 2 box colliders on same game object?  (Read 2018 times)

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
How do you destroy 2 box colliders on same game object?
« on: April 05, 2015, 12:19:21 AM »
So I have a tank that has 2 or more box colliders on it.  I want to be able to use the tank without the colliders for menus.  I tried the action 'destroy component' but it only destroys 1.  if I try to do multiple ones, it only destroys the first one.  the component name I am using is 'BoxCollider'.  This is a prefab that gets instantiated in the hierarchy though a variable.

So is there a way to tell the colliders apart?  Maybe different names or something?

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 66
Re: How do you destroy 2 box colliders on same game object?
« Reply #1 on: April 05, 2015, 07:08:20 AM »
You're right, it'll only grab the first one and disregard the second, unless they are different types (Box/Sphere/etc).

But -- if you can point at them directly (like dragging the individual colliders into the State and choosing Set Property), it seems disable works fine.

Hope that could be of use.
/Bad
The Force is with you, young Playmaker – but you are not a C# senpai yet.

wheretheidivides

  • Sr. Member
  • ****
  • Posts: 496
Re: How do you destroy 2 box colliders on same game object?
« Reply #2 on: April 05, 2015, 11:52:57 AM »
I can't point at it because I instantiate a copy via a prefab.  All I have is a game object variable.  Right now my only workaround is before I instantiate the copy, I turn off the prefabs colliders.  When the scene is over I turn them back on.  Not ideal.