- Home /
turn "is trigger" button off?
how would you turn off the is trigger button when i collide with something. the following script doesn't work. could someone help me?
script:
var mushroom : Transform;
function OnTriggerEnter (hit : Collider)
{
if(hit.gameObject.tag == "Floor")
{
mushroom.isTrigger.enabled = false;
}
because it says is
}
Answer by DaveA · Aug 21, 2010 at 12:24 AM
mushroom is a Transform, does not contain 'isTrigger'
I think you need to call GetComponent:
mushroom.GetComponent(MeshCollider).isTrigger = false;
or
hit.isTrigger = false;
if you'd rather disable that.
tried transform.GetComponent(BoxCollider).isTrigger = false; But gets error : rror CS1503: Argument #1' cannot convert
object' expression to type `System.Type'
Answer by Daniel 6 · Aug 20, 2010 at 10:58 PM
take out the .enabled part, and it should work fine.
it still gives me the same error please comment back thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613071735im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Problems with scripts 0 Answers
Building system 0 Answers
C# code to Java code 1 Answer
How to toggle a key for a car to go forward or backward? 1 Answer