diff --git a/examples/button-clicker/Assets/DiscordController.cs b/examples/button-clicker/Assets/DiscordController.cs index 5b32db8..d9a2669 100644 --- a/examples/button-clicker/Assets/DiscordController.cs +++ b/examples/button-clicker/Assets/DiscordController.cs @@ -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); } diff --git a/examples/button-clicker/Assets/DiscordRpc.cs b/examples/button-clicker/Assets/DiscordRpc.cs index 4604bfe..c91491a 100644 --- a/examples/button-clicker/Assets/DiscordRpc.cs +++ b/examples/button-clicker/Assets/DiscordRpc.cs @@ -17,7 +17,6 @@ public class DiscordRpc [UnmanagedFunctionPointerAttribute(CallingConvention.Cdecl)] public delegate void SpectateCallback(string secret); - [System.Serializable] public struct EventHandlers { public ReadyCallback readyCallback; diff --git a/examples/button-clicker/Assets/Resources/discord-rpc.dll b/examples/button-clicker/Assets/Resources/discord-rpc.dll index dbaf4cf..6fea7bb 100644 Binary files a/examples/button-clicker/Assets/Resources/discord-rpc.dll and b/examples/button-clicker/Assets/Resources/discord-rpc.dll differ diff --git a/examples/button-clicker/Assets/main.unity b/examples/button-clicker/Assets/main.unity index 1710d1a..4825eb9 100644 --- a/examples/button-clicker/Assets/main.unity +++ b/examples/button-clicker/Assets/main.unity @@ -588,9 +588,9 @@ MonoBehaviour: partyId: abcdefg partySize: 1 partyMax: 10 - matchSecret: asdfasdfsafd - joinSecret: klkdkfbnbldknfvb - spectateSecret: nwertinvnvldfkvnk + matchSecret: + joinSecret: + spectateSecret: instance: 0 applicationId: 338030514596216832 callbackCalls: 0