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?
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?)
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.