Hello!..
it is possible to disable or remove a collider component from a gameobject through unityscript.?
Hello!..
it is possible to disable or remove a collider component from a gameobject through unityscript.?
Yes, thats possible. Use Destroy():
// When the user presses Ctrl, it will remove the script
// named FooScript from the game object
function Update ()
{
if (Input.GetButton ("Fire1") GetComponent (FooScript))
Destroy (GetComponent (FooScript));
}
To remove the collider:
// When the user presses Ctrl, it will remove the script
// named FooScript from the game object
function Update ()
{
if (Input.GetButton ("Fire1") GetComponent (Collider))
Destroy (GetComponent (Collider));
}
Excelent thank you both !.