Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

Not able to compile Youtube API

Discussion in 'Experimental Scripting Previews' started by manarito, Nov 17, 2016.

  1. manarito

    manarito

    Joined:
    Nov 17, 2016
    Posts:
    5
    Hi,

    I'm trying to compile an app making use of the proper Youtube API v3 now that there is "support" for 4.5+
    But upon importing the dll files (I'm using the .Net 4.5 pre-built ones from the Nuget package), I get the following

    Google.Apis - OK
    Google.Apis.Core - Warning:
    SpritePacker failed to get types from Google.Apis.Core, Version=1.19.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab. Error: The classes in the module cannot be loaded.
    UnityEditor.Sprites.Packer:GetSelectedPolicyId()​

    Google.Apis.PlatformServices - Warning:
    SpritePacker failed to get types from Google.Apis.PlatformServices, Version=1.19.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab. Error: The classes in the module cannot be loaded.
    UnityEditor.Sprites.Packer:GetSelectedPolicyId()​

    Google.Apis.YouTube.v3 - OK
    Google.Apis.Auth - OK
    Google.Apis.Auth.PlatformServices - Blocking compiler errors :

    FileNotFoundException: Could not load file or assembly or one of its dependencies.
    System.Reflection.MonoMethodInfo.GetMethodInfo (System.IntPtr handle) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:67)
    System.Reflection.MonoMethod.GetPseudoCustomAttributes () (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:405)
    System.MonoCustomAttrs.GetPseudoCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:77)
    System.MonoCustomAttrs.IsDefined (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MonoCustomAttrs.cs:320)
    System.Reflection.MonoMethod.IsDefined (System.Type attributeType, System.Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:386)
    System.Attribute.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType, System.Boolean inherit) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/attribute.cs:627)
    System.Attribute.IsDefined (System.Reflection.MemberInfo element, System.Type attributeType) (at /Users/builduser/buildslave/mono/build/mcs/class/referencesource/mscorlib/system/attribute.cs:602)
    UnityEditor.EditorAssemblies.ProcessStaticMethodAttributes (System.Type type) (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:95)
    UnityEditor.EditorAssemblies.ProcessInitializeOnLoadAttributes () (at C:/buildslave/unity/build/Editor/Mono/EditorAssemblies.cs:158)
    UnityEditor.EditorAssemblies:processInitializeOnLoadAttributes()​

    Then​

    Unloading broken assembly Assets/GoogleAPIs/Google.Apis.Auth.PlatformServices.dll, this assembly can cause crashes in the runtime
    The Google.Apis.* requirement is due to the need of getting an OAuth2 token for user specific functionality.

    Note that I've tried the .Net Standard 1.3 versions of the packages too and these give these errors:
    Assets/Test.cs(48,7): error CS0012: The type `System.Object' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

    Assets/Test.cs(63,32): error CS0012: The type `System.IDisposable' is defined in an assembly that is not referenced. Consider adding a reference to assembly `System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
    I've tried to create a mcs.rsp with content -r:System.Runtime, but that did not work. Error:
    error CS0006: Metadata file `System.Runtime' could not be found
    In all cases .Net Standard libraries would not help in my case because I cannot find any Google.Apis.Auth.PlatformServices for it and therefore no GoogleWebAuthorizationBroker available to get the token in the first place.

    Is there anything I can do from my side ? (Mostly on the 4.5 front)

    PS: Also for note and to be explicit, this is on a new project, no specific code added yet, just drag&drop of dlls to the project. API Compatibility Level was set to .Net 4.6 in "Project Settings > Player"
     
    Last edited: Nov 17, 2016
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,141
    Can send us a bug report with this project? Note that the bug reporter is not shipped yet with the editor preview build, so you will need to use a different version of Unity. But that should be fine. Just let me know the bug report number and I'll associate the bug with this discussion properly on our side.
     
  3. IvanShakhov

    IvanShakhov

    Joined:
    May 19, 2016
    Posts:
    32
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    4,141