hi guys from unityAnswer i need a little help for check/uncheck “IsTrigger” button from a
box collider put in a GameObject.
i have try this script but idk why don’t work:
//start code:
function Update()
{
collider.isTrigger.enabled = false;
}
//end code.
thx for reading.
Just make it
collider.isTrigger = false;
not isTrigger.enabled.
guys i need that when i press a button “f” the gameobject that have “the box collider” uncheck the button is trigger
use this code to toggle on/off the trigger:
function Update() {
if (Input.GetKeyDown("f")) {
//toggle istrigger
collider.isTrigger = !collider.isTrigger;
}
}
this is right?
i put this script in my gameobject that i want to check /uncheck istrigger?
function Update()
{
if (Input.GetKeyDown(“f”)) {
// toggle istrigger
collider.isTrigger = false;
}
}