Search Unity

Question Can't import Services.

Discussion in 'Unity Analytics' started by FoxAdventures, Jun 28, 2022.

  1. FoxAdventures

    FoxAdventures

    Joined:
    Jan 31, 2018
    Posts:
    77
    Code (CSharp):
    1.  
    2. using Unity.Services.Core;
    3. using Unity.Services.Analytics;
    These lines give an error in Unity, and I think that gives me other errors (that haven't even been posted online before AFAIA). I checked the Services tab in the Editor and it works. But I can't seem to import the library and use it in my script. This doesn't happen in my other projects.
     
  2. MileyUnity

    MileyUnity

    Joined:
    Jan 3, 2020
    Posts:
    92
    Any chance you have an ASMDEF in your scripts folder that doesn't have either Analytics or Core linked to it yet?
     
  3. FoxAdventures

    FoxAdventures

    Joined:
    Jan 31, 2018
    Posts:
    77
    I haven't created any ASMDEF files to my knowledge but interestingly I am getting this error ever since I imported Facebook SDK and wrote some code for it:

    DllNotFoundException: LibFBGPlatform
    fbg.Globals.init (System.String appId, System.String parameters) (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    Facebook.Unity.Windows.WindowsWrapper.Init (System.String appId, System.String clientToken) (at <7efe304ea9fb48f4a267734487a2d0cd>:0)
    Facebook.Unity.Windows.WindowsFacebook.Init (System.String appId, System.String clientToken, Facebook.Unity.HideUnityDelegate hideUnityDelegate, Facebook.Unity.InitDelegate onInitComplete) (at <32d22e9a3ba14e51b34c4dc93872a381>:0)
    Facebook.Unity.FB+<>c__DisplayClass36_0.<Init>b__0 () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)
    Facebook.Unity.FB+CompiledFacebookLoader.Start () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)

    DllNotFoundException: LibFBGPlatform
    fbg.Message..ctor () (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    fbg.Message.popMessage () (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    fbg.RequestManager.tick () (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    fbg.Globals.tick () (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    Facebook.Unity.Windows.WindowsWrapper.Tick () (at <7efe304ea9fb48f4a267734487a2d0cd>:0)
    Facebook.Unity.Windows.WindowsFacebook.Tick () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)
    Facebook.Unity.Windows.WindowsFacebookGameObject.Update () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)

    DllNotFoundException: LibFBGPlatform
    fbg.Globals.deinit () (at <9e3491e4f129472d86615e1ea0f0fe67>:0)
    Facebook.Unity.Windows.WindowsWrapper.Deinit () (at <7efe304ea9fb48f4a267734487a2d0cd>:0)
    Facebook.Unity.Windows.WindowsFacebook.Deinit () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)
    Facebook.Unity.Windows.WindowsFacebookGameObject.OnDestroy () (at <32d22e9a3ba14e51b34c4dc93872a381>:0)
     
  4. MileyUnity

    MileyUnity

    Joined:
    Jan 3, 2020
    Posts:
    92
    Hmm, looks to me like this might be an issue related to the FB package not being able to be imported properly and thus the rest of the compilation stopping and not making Analytics nor Core available. If you remove the FB package, does the error go away?
     
  5. FoxAdventures

    FoxAdventures

    Joined:
    Jan 31, 2018
    Posts:
    77
    I deleted the FacebookSDK package and reinstalled it. It asks me if I want to remove some files but I don't think it makes any difference to my situation. Either way, it gives me the error:

    Assembly 'Library/ScriptAssemblies/Unity.PlasticSCM.Editor.dll' will not be loaded due to errors:
    Reference has errors 'unityplastic'.
    Assembly 'Packages/com.unity.collab-proxy/Lib/Editor/PlasticSCM/unityplastic.dll' will not be loaded due to errors:
    unityplastic references strong named Newtonsoft.Json Assembly references: 12.0.0.0 Found in project: 13.0.0.0.
    Assembly Version Validation can be disabled in Player Settings "Assembly Version Validation"
    IOException: Sharing violation on path D:\Games\Game Packages\Hypercasual 3\Unity.Services.Core.Environments.csproj
    System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options, System.String msgPath, System.Boolean bFromProxy, System.Boolean useLongPath, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions,string,bool,bool,bool)
    System.IO.StreamWriter.CreateFile (System.String path, System.Boolean append, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string,bool,System.Text.Encoding)
    System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) (at <695d1cc93cca45069c528c15c9fdd749>:0)
    Microsoft.Unity.VisualStudio.Editor.FileIOProvider.WriteAllText (System.String fileName, System.String content) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/FileIOProvider.cs:33)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.SyncFileIfNotChanged (System.String filename, System.String newContents) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:442)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.SyncProjectFileIfNotChanged (System.String path, System.String newContents) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:359)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.SyncProject (UnityEditor.Compilation.Assembly assembly, System.Collections.Generic.Dictionary`2[TKey,TValue] allAssetsProjectParts, System.Collections.Generic.IEnumerable`1[T] responseFilesData, System.Collections.Generic.List`1[T] allProjectAssemblies, System.String[] roslynAnalyzerDllPaths) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:347)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.GenerateAndWriteSolutionAndProjects () (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:261)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.Sync () (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:171)
    Microsoft.Unity.VisualStudio.Editor.ProjectGeneration.SyncIfNeeded (System.Collections.Generic.IEnumerable`1[T] affectedFiles, System.Collections.Generic.IEnumerable`1[T] reimportedFiles) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/ProjectGeneration/ProjectGeneration.cs:110)
    Microsoft.Unity.VisualStudio.Editor.VisualStudioEditor.SyncIfNeeded (System.String[] addedFiles, System.String[] deletedFiles, System.String[] movedFiles, System.String[] movedFromFiles, System.String[] importedFiles) (at Library/PackageCache/com.unity.ide.visualstudio@2.0.9/Editor/VisualStudioEditor.cs:150)
    UnityEditor.CodeEditorProjectSync.PostprocessSyncProject (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromAssetPaths) (at <44c3723143904fb88deebc993c7bb491>:0)
    UnityEditor.AssetPostprocessingInternal.PostprocessAllAssets (System.String[] importedAssets, System.String[] addedAssets, System.String[] deletedAssets, System.String[] movedAssets, System.String[] movedFromPathAssets) (at <44c3723143904fb88deebc993c7bb491>:0)
    UnityEditor.AssetDatabase:MoveAssetToTrash(String)
    Google.VersionHandlerImpl:MoveAssetToTrash(String) (at /Users/smiles/dev/src/unity-jar-resolver/source/VersionHandlerImpl/src/VersionHandlerImpl.cs:1862)
    Google.<UpdateVersionedAssets>c__AnonStorey6:<>m__10() (at /Users/smiles/dev/src/unity-jar-resolver/source/VersionHandlerImpl/src/VersionHandlerImpl.cs:1964)
    Google.MultiSelectWindow:OnGUI() (at /Users/smiles/dev/src/unity-jar-resolver/source/VersionHandlerImpl/src/MultiSelectWindow.cs:225)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr, Boolean&)

    I am now going to update Unity to the latest version, see if that works, because I don't really understand what I'm looking at in the console.
     

    Attached Files:

  6. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    @FoxAdventures Are you using PlasticSCM as mentioned in the errors? Did you install any Google Play plugins? (second screenshot). You can remove any packages that you are not using. I might suggest you compare to a new/empty project and start there (although many packages are installed by default)
     
  7. FoxAdventures

    FoxAdventures

    Joined:
    Jan 31, 2018
    Posts:
    77
    I updated the Unity Editor hoping that might fix it, and then I reinstalled the SDK again, and now it gives this error:

    Code (CSharp):
    1. Assembly 'Assets/PlayServicesResolver/Editor/Google.VersionHandlerImpl_v1.2.135.0.dll' will not be loaded due to errors:
    2. Assembly name 'Google.VersionHandlerImpl' does not match file name 'Google.VersionHandlerImpl_v1.2.135.0'
     
  8. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Do you mean the Facebook SDK? We can't advise on the use of the FB SDK, I can only suggest to try using their latest version https://github.com/facebook/facebook-sdk-for-unity . This does not look related to Unity Analytics.