Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Collider "actives itself" when toggling Is Trigger from editor.

Discussion in 'Scripting' started by thegergo0202, Aug 21, 2018.

  1. thegergo0202

    thegergo0202

    Joined:
    Feb 20, 2017
    Posts:
    13
    Hi!
    I found a strange behaviour, my raycast is not hitting the box collider on a cube. After I change the "Is Trigger" boolean from the Inspector, the raycast can hit the collider. (I can start from false or true, the same happens.)
    Edit 1: And when I change the "Is Trigger" bool, the material on the preview gets whiter.
     
  2. thegergo0202

    thegergo0202

    Joined:
    Feb 20, 2017
    Posts:
    13
    I tried to change the Is Trigger from script, but it's not working. Possibly a bug?
    I'm using Unity 2018.2.1f1
    Edit: You can change anything, not just "Is Trigger" to get it working.
    Edit 2: I tried to assign a collider to it's parent empty gameobject, the behaviour is still the same.
     
    Last edited: Aug 21, 2018
  3. thegergo0202

    thegergo0202

    Joined:
    Feb 20, 2017
    Posts:
    13
    I found a workaround, I add the box collider component after spawning the cube.