Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Trigger Colliders on Tree Prefab Instances Won't Detect

Discussion in 'Editor & General Support' started by Velo222, Aug 29, 2020.

  1. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    I have placed trees on a Unity terrain using the default terrain component and "Paint Trees" tool (Mass Place Trees option).

    On the tree prefabs themselves I have colliders and scripts to detect when another collider "triggers" the tree collider. When a collider passes through/over the tree prefab collider trigger, however, nothing happens. The trigger collider does not seem to trigger anything on the tree itself.

    Which is my main question, why doesn't it work? Are tree instances on a terrain "packaged" and optimized in a way that any components on the tree prefab get ignored for performance purposes? Is this intentional or should the triggers on the tree instances work?

    I have the tree instances on a physics layer that should be detected by the other object. I have rigidbodies on both collider objects. But in my debug code, I don't get anything happening at all.

    Can tree instances behave like normal gameobjects in that regard?


    Note*: I should also add, in the terrain settings, I do have the "Preserve Tree Prototype Layers" checked.
     
  2. hedgefield

    hedgefield

    Joined:
    Jan 1, 2014
    Posts:
    39
    I'm having the same problem. I'd like to trigger some rustling leaves audio when the player collides with foliage, but the trigger collider that works on the prefab doesn't work when it's used as a terrain tree.
     
  3. nubbyninja

    nubbyninja

    Joined:
    May 16, 2019
    Posts:
    24
    It appears preserveTreePrototypeLayers stopped working some time ago and has yet to be addressed.
    I've tried similar to no avail in Unity 2021