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

Android delegate Feature request.

Discussion in 'Android' started by zezba9000, Apr 13, 2014.

  1. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    982
    Hi Unity team not sure the best place to bring this up but...

    When writing Unity3D plugins for Android it can be a pain in the butt if you need to use "onActivityResult" and don't want to override the "UnityPlayerActivity".
    Other APIs don't need this like iOS and WP8 ect as there callback system is much more logical across there APIs to be frank.
    On iOS you simply pass in a class that will be used to fire callbacks. On WP8 you simply attach delegate methods for callbacks. On Android some of there APIs are logical and use the same system as iOS, but others like GooglePlay IAP system does not.

    To fix this, if Unity3D would add a callback system like the one iOS uses for callbacks in your "UnityPlayerActivity" object, so I can pass in a custom class into UnityPlayerActivity to handle "onActivityResult" without overrider the "UnityPlayerActivity" would be awesome and fix so many issues.
    Example: "UnityPlayer.currentActivity.setDelegate(myDelegateClass);"

    To extend the example:
    class MyDelegateClass implements IUnityActivityDelegates
    {
    @override
    void onActivityResult() {...}

    ect....
    }
     
    Last edited: Apr 13, 2014
    estufa likes this.
  2. PixelSquad

    PixelSquad

    Joined:
    Sep 4, 2014
    Posts:
    114
    Excellent point! Do you know if any progress has been made in respect to this?
     
  3. zezba9000

    zezba9000

    Joined:
    Sep 28, 2010
    Posts:
    982
    To my knowledge Unity doesn't seem to have any desire to address this plugin issue. I'll be adding support for there Google Proj export to get around the issue and help with plugin conflicts. If Unity would directly support Android Studios projs just like they directly support xCode / VS projs we wouldn't be having any issues. My guess is it will be Unity7 before anything about this is even considered at all.