Open Bluscream opened 5 years ago
Can you please make sure the client has a logger that is writing to your logs and is in TRACE. Additionally, I see you are using Unity 5.6.6f2
... This version can be a bit picky on how it loads libraries.
Please make sure you include the native pipe wrapper that the unity example has as Unity by itself doesn't actually support pipes.
After setting the level to trace i got some more atleast
INFO: Attempting a new connection
INFO: RPC Connection StartedINFO: RPC Connection Started
[16:31:00.245] <EFTDiscordPresence> Info - Mod.InitRPC: [Discord] RichPresence Initialised
ERR : Cannot Invoke client when AutomaticallyInvokeEvents has been set.
R : Cannot Invoke client when AutomaticallyInvokeEvents has beeTRACE: ============================
TRACE: Assembly: DiscordRPC, Version=1.0.132.0, Culture=neutral, PublicKeyToken=null
TRACE: Pipe: DiscordRPC.IO.ManagedNamedPipeClient
TRACE: Platform: Microsoft Windows NT 10.0.18362.0
TRACE: applicationID: 628201599025545226
TRACE: targetPipe: 1
TRACE: POLL_RATE: 1000
TRACE: _maxRtQueueSize: 512
TRACE: _maxRxQueueSize: 0
TRACE: ============================
TRACE: Connecting to the pipe through the DiscordRPC.IO.ManagedNamedPipeClient
TRACE: ManagedNamedPipeClient.Connection(1)
TRACE: Connection Attempt 1 ()
INFO: Attempting to connect to discord-ipc-1
ERR : Failed connection to discord-ipc-1. The operation completed successfully.
WARN: Tried to close a already closed pipe.
TRACE: Done. Result: True
TRACE: Skipping sandbox connection.
ERR : Failed to connect for some reason.
[16:31:00.302] <EFTDiscordPresence> Info - <>c.<InitRPC>b__11_6: OnRpcMessage ConnectionFailed
[16:31:00.312] <EFTDiscordPresence> Info - <>c.<InitRPC>b__11_5: OnConnectionFailed 1: ConnectionFailed
TRACE: Enqueued Message, but queue size is 0.
TRACE: Creating Windows Scheme CreatorTRACE: Creating Windows Scheme Creator
ACE: Waiting 1095ms before attempting to connect again
TRACE: Enqueue Command: DiscordRPC.RPC.Commands.SubscribeCommand
TRACE: Enqueue Command: DiscordRPC.RPC.Commands.SubscribeCommand
TRACE: Enqueue Command: DiscordRPC.RPC.Commands.SubscribeCommand
[16:31:00.344] <JustEmuTarkov> Info - Mod.OnApplicationStart: OnApplicationStart
[16:31:00.381] <Test Plugin> Debug - ExternalConsole.InitConsole: Console already present, not allocating second time
[16:31:00.383] <Test Plugin> Info - Main.OnApplicationStart: OnApplicationStart
TRACE: Setting the connection state to DISCONNECTED
TRACE: Connecting to the pipe through the DiscordRPC.IO.ManagedNamedPipeClient
TRACE: ManagedNamedPipeClient.Connection(1)
TRACE: Connection Attempt 1 ()
INFO: Attempting to connect to discord-ipc-1
ERR : Failed connection to discord-ipc-1. The operation completed successfully.
WARN: Tried to close a already closed pipe.
Okay, since you are using Unity, you are required to use the NativeNamedPipe, not the Managed. Please look at the Unity example as a sample.
Is it right that i have put discord-rpc.dll
(dynamic x64) in <game>/Data/Plugins
?
Also i can not set AutoEvents as described in the readme because it's private.
AutoEvents is part of the constructor: https://github.com/Lachee/discord-rpc-csharp/blob/master/DiscordRPC/DiscordRpcClient.cs#L217
so you will want to do
client = new DiscordRpcClient(discordAppId, autoEvents: false);
Ill get to it in a few hours and try again. Btw does it need to be in a monobehavior or does it also work in a plain IPA plugin?
¯_(ツ)_/¯
Don't forget that you are required to use the NativeNamedPipeClient, not the managed. Like I mentioned before, examples on how it works can be found in the Unity project included in this repository.
You can't import unitypackages into a game by someone else :'D anyway, i already imported your pipeclient from your ci into my plugin
I made sure but it definitly is loaded:
[16:40:28.468] <EFTDiscordPresence> Info - Mod.OnGameInitialized: Loaded assemblies:
?, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
0Harmony, Version=1.2.0.1, Culture=neutral, PublicKeyToken=null
AmplifyMotion, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Assembly-CSharp-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Assembly-UnityScript, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Assembly-UnityScript-firstpass, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Comfort, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null
Comfort.Unity, Version=1.0.0.4, Culture=neutral, PublicKeyToken=null
DecalSystem.Runtime, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
+ DiscordRPC, Version=1.0.121.0, Culture=neutral, PublicKeyToken=null
DynamicLoadingKit, Version=1.0.5640.17315, Culture=neutral, PublicKeyToken=null
+ EFTDiscordPresence, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
HarmonySharedState, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
IllusionInjector, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
IllusionPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
JustEmuTarkov, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
KdTreeLib, Version=1.3.0.0, Culture=neutral, PublicKeyToken=null
mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed
NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c
pb_Stl, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Poly2Tri, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
ProBuilderCore-Unity5, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
ProBuilderMeshOps-Unity5, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Runtime.Serialization, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
TestPlugin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
TextMeshPro-5.6-Runtime, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
UnityEngine.Networking, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
+ UnityNamedPipe, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null