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

Dynamic callback added runtime on EventTrigger PointerClick on AssetBundle gameobject does not work

Discussion in 'Asset Bundles' started by thesanketkale, Oct 15, 2021.

  1. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    63
    I have an asset bundle with a basic 3D gameobject. I added a pointer click event trigger at runtime to the gameobject loaded from the asset bundle and set a callback to open a UI panel. But this callback does not get hit on pointer click on the gameobject.

    I have the basic things in place like the colliders and event trigger set properly. If I set the event trigger in the Unity Editor before building asset bundle, the serialized callback gets hit, but adding an event trigger runtime does not.

    Is there anything I am missing to make this work, is it something by design or it a bug?
     
  2. thesanketkale

    thesanketkale

    Joined:
    Dec 14, 2016
    Posts:
    63
    Well, it works only if you add the EventTrigger callbacks after the gameobject is active in the scene. This should have been available in the documentation, but anyways.