Search Unity

HELP! Error when using Standard Events

Discussion in 'Unity Analytics' started by Kaldrax, Apr 17, 2018.

  1. Kaldrax

    Kaldrax

    Joined:
    Sep 14, 2017
    Posts:
    44
    Hey Unity team!

    I'm getting this error in Monodevelop when I try to use an AnalyticsEvent:

    The type 'UnityEngine.Analytics.AnalyticsResult' is defined in an assembly that is not referenced. Consider adding a reference to assembly 'UnityEngine.UnityAnalyticsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null

    Any advice?
     
    lior_rosenspitz likes this.
  2. marc_tanenbaum

    marc_tanenbaum

    Unity Technologies

    Joined:
    Oct 22, 2014
    Posts:
    637
    Hey @Kaldrax ...

    Could you let me know which version of Unity you're using and on which platform? Either myself or someone else on the team can take a look.

    My first guess: have you tried adding
    Code (CSharp):
    1. using UnityEngine.Analytics;
    at the top of your file?
     
  3. Kaldrax

    Kaldrax

    Joined:
    Sep 14, 2017
    Posts:
    44
    Nevermind. Found the DLL and added it.

    Yeah I was using UnityEngine.Analytics
    Mono just didn't seem to have a reference to the UnityAnalyticsModule
     
    marc_tanenbaum likes this.
  4. Ponytech

    Ponytech

    Joined:
    Jun 13, 2016
    Posts:
    33
    Same problem here.
    Can you explain where you found the DLL and where did you add it?
    Thanks!
     
    lior_rosenspitz likes this.
  5. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Ponytech

    Can you give us more details about the issue:

    Are you also using Monodevelop?
    Which version of Unity are you using?
    And which platform you are on?
     
  6. Ponytech

    Ponytech

    Joined:
    Jun 13, 2016
    Posts:
    33
    @ap-unity

    Unity 2017.4.1f1
    Mac OS X 10.13.3

    The game works just fine, the issue is in Monodevelop when I want to attach the debugger :

    Error CS0012: The type `UnityEngine.Analytics.AnalyticsResult' is defined in an assembly that is not referenced. Consider adding a reference to assembly `UnityEngine.UnityAnalyticsModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' (CS0012) (Assembly-CSharp)
     
    lior_rosenspitz likes this.
  7. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Ponytech

    Could you share the script you using when you get this error?
    Do you have the following at the top of the file?

    using UnityEngine.Analytics;
     
  8. Ponytech

    Ponytech

    Joined:
    Jun 13, 2016
    Posts:
    33
    Of course I do, as I said the game works just fine, the problem is only with MonoDevelop when attaching the debugger.

    Example script:

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Analytics;
    3.  
    4. public class Game : MonoBehaviour {
    5.  
    6.  
    7.     void Start() {
    8.            AnalyticsEvent.ScreenVisit("Start");
    9.     }
    10. }
    11.  
    12.  
     
  9. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    Last edited: May 14, 2018
  10. p0w1nd

    p0w1nd

    Joined:
    Oct 28, 2015
    Posts:
    140
    lior_rosenspitz likes this.
  11. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    @Ponytech, @phong-genix

    Yeah, those issues are probably related. There is a fix in review for 2017.4 and 2017.3. Hopefully this will be resolved in an upcoming patch.
     
    p0w1nd likes this.
  12. Jonathan-FourFats

    Jonathan-FourFats

    Joined:
    Apr 21, 2016
    Posts:
    22
  13. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,519
    We do have a fix ready for this and a patch should be available soon (if not already). Thanks everyone for reporting this issue.
     
  14. thefirstplaybae

    thefirstplaybae

    Joined:
    Feb 15, 2013
    Posts:
    16
    I am using 2017.4.3f1 and still facing this issue. @Kaldrax can you please tell how exactly you solved this ?
     
  15. thefirstplaybae

    thefirstplaybae

    Joined:
    Feb 15, 2013
    Posts:
    16
    Ok I found it , in monodevelop, you have to go to project/edit references/.Net assembly and here you have to add the module. It , obviously wont be there, hence you will have to browse it in your unity folder (Editor/Data/Managed/UnityEngine).