Search Unity

Namespace trouble after upgrading

Discussion in 'Unity Analytics' started by mpete, Apr 23, 2015.

  1. mpete

    mpete

    Joined:
    Aug 26, 2013
    Posts:
    10
    A while ago i imported the Unity Analytics package.
    Recently I deleted the associated files (at least I think I deleted all of them) and imported the latest version Download v1.9.0 (last updated on April 6, 2015)
    Now i get two errors:
    1.
    Error importing folder (The pathName assets/plugins/unityanalytics is already mapped to fbf55d4d2344f4c29999ae6aefe608de. But the meta data wants it to be mapped to a8de6934034264ad79dc56517cb7b0f1)

    2.
    Assets/Script/UnityAnalyticsIntegration.cs(3,19): error CS0234: The type or namespace name `Analytics' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?

    The code line error 2 is refering to is
    Analytics.StartSDK (projectId);


    Suggestions how to make the meta data happy and the analytics work would make me happy!

    Regards
    Peter
     
  2. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    Hi,

    #1 This is a known issue in 5.x, seems that deleting certain kinds of folders/files doesn't delete the meta files, so when importing new files that have the same name as the old files, it gives this error. This error should only appear at the time of import, and it's a harmless error.
    #2. That was our mistake, the namespace should be UnityEngine.Cloud.Analytics and the classname should be UnityAnalytics.StartSDK(projectId). We updated our docs to reflect this change.
     
    mpete likes this.
  3. mpete

    mpete

    Joined:
    Aug 26, 2013
    Posts:
    10
    Thank you for answering and for updating the integration guide! Now it works! :)
     
  4. mpete

    mpete

    Joined:
    Aug 26, 2013
    Posts:
    10
    Update: The game is running in unity, but MonoDevelop has got some issues related to Unity Analytics:
    Among more the auto completion of all code is broken, i can't search for declaration of methods and I get the following error message (file path and stack edited for readability)

    System.IO.FileNotFoundException: Could not find file "...Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll".

    File name: '...Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll'

    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0

    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0

    at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)

    at Mono.Cecil.ModuleDefinition.GetFileStream (System.String fileName, FileMode mode, FileAccess access, FileShare share) [0x00022] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/external/cecil/Mono.Cecil/ModuleDefinition.cs:963

    at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/external/cecil/Mono.Cecil/ModuleDefinition.cs:933

    at Mono.Cecil.AssemblyDefinition.ReadAssembly (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/external/cecil/Mono.Cecil/AssemblyDefinition.cs:140

    ... blah blah blah ...

    at MonoDevelop.Components.Commands.CommandManager.GetCommandInfo (System.Object commandId, MonoDevelop.Components.Commands.CommandTargetRoute targetRoute) [0x001a9] in /home/builduser/buildslave/monodevelop/build/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1223


    ----
    Any suggestions to repair this? Where can I find the UnityEngine.Cloud.Analytics.dll file?
     
    Last edited: Apr 24, 2015
  5. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    There might still be bits from the older SDK that was left, and it's pointing to the file "...Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll" that doesn't exist.

    Reimporting again from a clean state should fix your problem.

    If you are using Unity 4.x, you can just delete "...Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll" and import the 1.9.x SDK, and that should do the trick.
    If you are using Unity 5.x, you must delete all the existing files and import the new SDK.

    Here's the older SDK's file structure:





    Here's the new SDK's file structure:

     
  6. mpete

    mpete

    Joined:
    Aug 26, 2013
    Posts:
    10
    I tried to delete all new and old analytics-files (including meta files), reinstall analytics and reimport the plugin folder in Unity, but MonoDevelop is still broken:
    upload_2015-4-27_8-8-56.png
    The error details are still the same:

    System.IO.FileNotFoundException: Could not find file ".../Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll".
    File name: '.../Assets/Plugins/UnityAnalytics/UnityEngine.Cloud.Analytics.dll'
    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0
    at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0
    at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
    ...

    Are there any meta files outside of Plugins that I should remove, or any other suggestions?
     
  7. kentunity

    kentunity

    Unity Technologies

    Joined:
    Sep 16, 2014
    Posts:
    55
    Let me try and reproduce this, what version of Unity are you using?
     
  8. mpete

    mpete

    Joined:
    Aug 26, 2013
    Posts:
    10