Hi, I have a problem with setting up Flurry in my Android game. I did everything what is described here but my console says that in functions other than Start() (for example in Update() or OnApplicationQuit()) there is an error: “NullReferenceException: Object reference not set to an instance of an object”. This is my code:
using UnityEngine;
using System.Collections;
public class GameController : MonoSingleton {
//private variables
private string language;
private FlurryAgent flurry;
//public variables
public RigidDonut donut;
public Pursuit helicopter;
public bool chocolateRain = false;
// Use this for initialization
void Start () {
LoadLanguage();
flurry = new FlurryAgent ();
flurry.onStartSession ("my ID");
flurry.logEvent ("Application started");
}
// Update is called once per frame
void Update () {
flurry.onPageView ();
}
public void LoadLanguage() {
string language;
if (PlayerPrefs.HasKey("Language")) {
language = PlayerPrefs.GetString("Language");
}
else {
language = "English";
PlayerPrefs.SetString("Language", language);
PlayerPrefs.Save();
}
Localization.loadLanguage(language);
}
public void OnApplicationQuit() {
flurry.onEndSession ();
}
}
If anyone could help me I’d be grateful