3

I have just built a game and would like to integrate the GameAnalytics SDK. I have installed the package, however within the documentation it states:

Important Announcement From v3.11.0 and onwards you need to manually initialize the SDK by calling GameAnalytics.Initialize() from your own GameObject (with script execution order coming after GameAnalytics script’s order if your object is in the same scene as the GameAnalytics object as some code is called on Awake event which needs to be called before initializing the sdk).

How and where do I call the GameAnalytics.Initialize() ?

RevolverBloom
  • 39
  • 1
  • 4

2 Answers2

2

You can initialize the SDK anytime you are ready to collect analytics. In most projects this happens sometime at start up. What the documentation states is that you just have to make sure your initialization call happens after GameAnalytics performs internal initialization.

In practice this means that if you have the GameAnalytics object in your start up scene, you must do the initialization after the objects Awake() call. To do this, you can call the init method in later even function, for instance, Start(). You can check the order of even functions here: https://docs.unity3d.com/Manual/ExecutionOrder.html

Alternatively, you can also use Awake() with script execution order set to after GameAnalytics script. You can read on how to do this here: https://docs.unity3d.com/Manual/class-MonoManager.html

Bartosz
  • 732
  • 9
  • 30
0

If you have a Game Manager object you can add it to the Start() of the script attached with the Game Manager or any other object with a script.

Don't forget to call the GameAnalyticsSDK namespace.

medox
  • 1