Search Unity

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:
    65
    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:
    65
    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.