private void OnEnable()
    {
        //Make sure we are allowed to be active.
        if (!active || !gameObject.activeSelf)
        {
            return;
        }
        if (!Application.isPlaying)
        {
            return;
        }

        //This has a instance already that isn't us
        if (_instance != null && _instance != this)
        {
            Destroy(this);
            return;
        }

        //Assign the instance
        _instance = this;
        DontDestroyOnLoad(this);

        //We are starting the client. Below is a break down of the parameters.
        Debug.Log("[DRP] Starting Discord Rich Presence");
        _client = new DiscordRpcClient(
            applicationID,                                              //The Discord Application ID
            steamID,                                                    //The Steam App. This can be null or empty string to disable steam intergration.
            registerUriScheme,                                          //Should the client register a custom URI Scheme? This must be true for endpoints
            (int )targetPipe,                                           //The target pipe to connect too
            new NativeNamedPipeClient()                                 //The client for the pipe to use. Unity MUST use a NativeNamedPipeClient since its managed client is broken.
            );

        //Update the logger to the unity logger
        _client.Logger = new UnityLogger()
        {
            Level = logLevel
        };

        //Subscribe to some initial events
        #region Event Registration
        client.OnReady += (s, args) =>
        {
            //We have connected to the Discord IPC. We should send our rich presence just incase it lost it.
            Debug.Log("[DRP] Connection established and received READY from Discord IPC. Sending our previous Rich Presence and Subscription.");

            //Set the user and cache their avatars
            _currentUser = args.User;
            _currentUser.GetAvatar(this, DiscordAvatarSize.x128);
        };
        client.OnPresenceUpdate += (s, args) =>
        {
            Debug.Log("[DRP] Our Rich Presence has been updated. Applied changes to local store.");
            _currentPresence = (DiscordPresence)args.Presence;
        };
        client.OnSubscribe += (s, a) =>
        {
            Debug.Log("[DRP] New Subscription. Updating local store.");
            _currentSubscription = client.Subscription.ToUnity();
        };
        client.OnUnsubscribe += (s, a) =>
        {
            Debug.Log("[DRP] Removed Subscription. Updating local store.");
            _currentSubscription = client.Subscription.ToUnity();
        };
        client.OnError += (s, args) =>
        {
            //Something bad happened while we tried to send a event. We will just log this for clarity.
            Debug.LogError("[DRP] Error Occured within the Discord IPC: (" + args.Code + ") " + args.Message);
        };

        client.OnJoinRequested += (s, args) =>
        {
            Debug.Log("[DRP] Join Requested");
        };

        events.RegisterEvents(client);
        #endregion

        //Start the client
        _client.Initialize();
        Debug.Log("[DRP] Discord Rich Presence intialized and connecting...");

        //Set initial presence and sub. (This will enqueue it)
        SetSubscription(_currentSubscription);
        SetPresence(_currentPresence);
    }
    private void OnEnable()
    {
        //Make sure we are allowed to be active.
        if (!active)
        {
            return;
        }
        if (!Application.isPlaying)
        {
            return;
        }

        //This has a instance already that isn't us
        if (_instance != null && _instance != this)
        {
            Destroy(this);
            return;
        }

        //Assign the instance
        _instance = this;
        DontDestroyOnLoad(this);

        //We are starting the client. Below is a break down of the parameters.
        Debug.Log("[DRP] Starting Discord Rich Presence");
        _client = new DiscordRpcClient(
            applicationID,                                              //The Discord Application ID
            steamID,                                                    //The Steam App. This can be null or empty string to disable steam intergration.
            registerUriScheme,                                          //Should the client register a custom URI Scheme? This must be true for endpoints
            (int )targetPipe,                                           //The target pipe to connect too
            new NativeNamedPipeClient()                                 //The client for the pipe to use. Unity MUST use a NativeNamedPipeClient since its managed client is broken.
            );

        //Update the logger to the unity logger
        _client.Logger = new UnityLogger()
        {
            Level = logLevel
        };

        //Subscribe to some initial events
        client.OnReady          += ClientOnReady;
        client.OnError          += ClientOnError;
        client.OnPresenceUpdate += ClientOnPresenceUpdate;

        client.OnSubscribe += (s, a) =>
        {
            Debug.Log("[DRP] New Subscription. Updating local store.");
            subscription = client.Subscription.ToUnity();
        };
        client.OnUnsubscribe += (s, a) =>
        {
            Debug.Log("[DRP] Removed Subscription. Updating local store.");
            subscription = client.Subscription.ToUnity();
        };

        events.RegisterEvents(client);

        //Start the client
        _client.Initialize();
        Debug.Log("[DRP] Discord Rich Presence intialized and connecting...");
    }