public void Awake()
{
lock (_lock)
{
if (_instance == null)
{
// singleton instance
_instance = this;
if (_mainThread == null || !_mainThread.Equals(Thread.CurrentThread))
_mainThread = Thread.CurrentThread;
AmazonHookedPlatformInfo.Instance.Init();
// preventing the instance from getting destroyed between scenes
DontDestroyOnLoad(this);
//initialize the logger
TraceListener tracelistener = new UnityDebugTraceListener("UnityDebug");
AWSConfigs.AddTraceListener("Amazon", tracelistener);
// Associate the main thread dispatcher
_instance.gameObject.AddComponent<UnityMainThreadDispatcher>();
}
else
{
if (this != _instance)
{
//destroy the new instance
DestroyObject(this);
}
}
}
}
#endregion