Unity example working better.
This commit is contained in:
parent
f06b187d2d
commit
f6853fac1b
4 changed files with 15 additions and 15 deletions
|
@ -3,12 +3,13 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
public class DiscordController : MonoBehaviour {
|
||||
public DiscordRpc.EventHandlers handlers;
|
||||
public DiscordRpc.RichPresence presence;
|
||||
public string applicationId;
|
||||
public int callbackCalls;
|
||||
public int clickCounter;
|
||||
|
||||
DiscordRpc.EventHandlers handlers;
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
Debug.Log("Discord: on click!");
|
||||
|
@ -50,23 +51,23 @@ public class DiscordController : MonoBehaviour {
|
|||
}
|
||||
|
||||
void Start () {
|
||||
handlers = new DiscordRpc.EventHandlers();
|
||||
handlers.readyCallback = ReadyCallback;
|
||||
handlers.disconnectedCallback = DisconnectedCallback;
|
||||
handlers.errorCallback = ErrorCallback;
|
||||
handlers.joinCallback = JoinCallback;
|
||||
handlers.spectateCallback = SpectateCallback;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
|
||||
DiscordRpc.RunCallbacks();
|
||||
}
|
||||
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
var p = System.Diagnostics.Process.GetCurrentProcess();
|
||||
Debug.Log(string.Format("Discord: init {0}", p.Id));
|
||||
Debug.Log("Discord: init");
|
||||
callbackCalls = 0;
|
||||
|
||||
handlers = new DiscordRpc.EventHandlers();
|
||||
handlers.readyCallback = ReadyCallback;
|
||||
handlers.disconnectedCallback += DisconnectedCallback;
|
||||
handlers.errorCallback += ErrorCallback;
|
||||
handlers.joinCallback += JoinCallback;
|
||||
handlers.spectateCallback += SpectateCallback;
|
||||
DiscordRpc.Initialize(applicationId, ref handlers, true);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue