Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

AssetDatabase.ImportPackage Callbacks don't work ?

Discussion in 'Extensions & OnGUI' started by baptisteb_unity, Aug 6, 2018.

  1. baptisteb_unity

    baptisteb_unity

    Joined:
    Feb 13, 2018
    Posts:
    3
    Hello !

    I'm making a tool where I have to import a custom package from Github, and I need a call back when it's completed in editor.

    For that I use as recommend by the doc the AssetDatabase.ImportPackage callback, more precisely AssetDatabase.importPackageCompleted.

    Here is the function where I declare the callbacks:

    Code (CSharp):
    1. void Download()
    2. {
    3. AssetDatabase.importPackageCompleted += ImportCompleted;
    4.                             AssetDatabase.importPackageCancelled += ImportCancelled;
    5.                             AssetDatabase.importPackageFailed += ImportCallBackFailed;
    6.                             AssetDatabase.importPackageStarted += ImportStarted;
    7.  
    8.  
    9. }
    10.  
    11.  
    And here the functions called by the callbacks:

    Code (CSharp):
    1.  static void ImportCompleted(string packageName)
    2.         {
    3.             Debug.Log ("Completed " + packageName);
    4.             AssetDatabase.importPackageCompleted -= ImportCompleted;
    5.         }
    6.        
    7.         static void ImportCancelled(string packageName)
    8.         {
    9.             Debug.Log ("Cancelled " + packageName);
    10.             AssetDatabase.importPackageCancelled -= ImportCancelled;
    11.         }
    12.        
    13.         static void ImportCallBackFailed(string packageName, string _error)
    14.         {
    15.             Debug.Log ("Failed " + packageName);
    16.             AssetDatabase.importPackageFailed -= ImportCallBackFailed;
    17.         }
    18.        
    19.         static void ImportStarted(string packageName)
    20.         {
    21.             Debug.Log ("Started " + packageName);
    22.             AssetDatabase.importPackageStarted -= ImportStarted;
    23.         }
    The only callback that works is the ImportStarted one.
    Any idea?
     
  2. PsyKaw

    PsyKaw

    Joined:
    Aug 16, 2012
    Posts:
    86
  3. baptisteb_unity

    baptisteb_unity

    Joined:
    Feb 13, 2018
    Posts:
    3
    Hello !
    I try to put an AssetDatabase.Refresh (before and after by the way ^^) but it doesn't work.
     
  4. baptisteb_unity

    baptisteb_unity

    Joined:
    Feb 13, 2018
    Posts:
    3
    Oh btw, the issue tracker is put as fixed but no version is precise.