AppMetrica.cs 582 B

123456789101112131415161718192021222324
  1. using System.Runtime.InteropServices;
  2. using UnityEngine;
  3. public static class AppMetricaWeb
  4. {
  5. public const string Default = "reachGoal";
  6. [DllImport("__Internal")]
  7. private static extern void SendEvent(string key, string EventName);
  8. public static void Event(string eventName)
  9. {
  10. Debug.Log("AppMetrica Event :"+eventName);
  11. #if UNITY_WEBGL && !UNITY_EDITOR
  12. SendEvent(Default, eventName);
  13. #endif
  14. }
  15. public static void Event(string key, string eventName)
  16. {
  17. #if UNITY_WEBGL && !UNITY_EDITOR
  18. SendEvent(key, eventName);
  19. #endif
  20. }
  21. }