I can't find a way to disable a collider. Is there one? I'm about to just move the collider to the right 999999 units.... EDIT: Also, are the script hooks broken? trying to access either collider.bounds or collider.center gives me a MissingFieldException.
No, you can't enable/disable a collider. However, you can remove one (just like any other component): Destroy(collider) collider.center and collider.bounds: does the game object that the script is attached to actually have the collider? Haven't you accidentally declared your own variable named 'collider' (of different type) somewhere in the script?
Well, I'd rather not have to rebuild the collider every time I want to enable/disable it. As for the second - I'm 90% sure every object this script is on has a collider, and nothing else is named collider. I'll check again later (it's working fine right now with the "moving the transform really far away" approach for now)
Hey StarManta You seem to have more answers than I , in general, but what about making the object inactive? Code (csharp): var Wall : GameObject; function Whatever(){ Wall.active = false; } If that messes with other stuff (Like making it inactive stops other behaviours) You could duplicate the object in the same space, put some scripts on one(with collider) and other scripts etc on another(and use a trigger?) AC
I could do that, but that would 1) require me to create extra scripts and 2) require me to create extra objects, and 3) would require me to hook them all up. It turns out to be mucher simpler to set transform.position to (999999.9,999999.9,999999.9) and then return it when i need it to come back. I posted here hoping for a better solution than that.
This is really impractical. What happens when you want to turn the collider back on but you've destroyed it? I know there's an active state for the component because you can uncheck any component in the editor -- why not just expose that to the script?