Closed holmraven closed 6 years ago
I'm using Unity
There's a couple things you can do. You can either get it from our releases, or you can run python build.py unity
in the root directory of the repository to compile the latest and greatest from the source code.
There's .h and .lib files in releases, what I am supposed to do with them?
Unity requires dll file from me
The releases also include .dll
files in win64-dynamic/bin/
.
In your Assets
folder in Unity, you'll need a Plugins
folder. In that folder, you'll need a x86
folder and a x86_64
folder for 32 and 64 bit versions of your game. You should place the 32 and 64 bit dlls inside those two respective folders.
The .h
file is a header file, which you don't need for unity. What you will need is the DiscordRpc.cs
file from the unity example, which is how your Unity game will talk to the dll.
What I recommend is doing this:
python build.py unity
from the root directorydiscord-rpc/examples/button-clicker
example in UnityDiscordController.cs
for how to talk to the SDK.Problem when building with python
$ python build.py unity
--- Building win32-dynamic
Traceback (most recent call last):
File "build.py", line 313, in <module>
sys.exit(cli())
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "build.py", line 79, in unity
just_release=True
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "build.py", line 297, in libs
build_lib('win32-dynamic', generator32, dynamic_options, just_release)
File "build.py", line 194, in build_lib
subprocess.check_call(initial_cmake)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 286, in check_call
retcode = call(*popenargs, **kwargs)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
You'll need to install CMake. https://cmake.org/download/
Or, you can download the files from releases, and put them in those folders I mentioned.
I have CMake, as I said the files from releases don't work, because I don't think c++ and c# code can contact directly. I tried to manipulate with them but unity requires a dll from me
--- Building win32-dynamic
-- Selecting Windows SDK version to target Windows 10.0.16299.
CMake Error at CMakeLists.txt:2 (project):
Failed to run MSBuild command:
MSBuild.exe
to get the value of VCTargetsPath:
The system cannot find the file specified
-- Configuring incomplete, errors occurred!
See also "C:/Users/deivi/Desktop/discord-rpc-master/builds/win32-dynamic/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "build.py", line 313, in <module>
sys.exit(cli())
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 697, in main
rv = self.invoke(ctx)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "build.py", line 79, in unity
just_release=True
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\site-packages\click\core.py", line 535, in invoke
return callback(*args, **kwargs)
File "build.py", line 297, in libs
build_lib('win32-dynamic', generator32, dynamic_options, just_release)
File "build.py", line 194, in build_lib
subprocess.check_call(initial_cmake)
File "C:\Users\deivi\AppData\Local\Programs\Python\Python36\lib\subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\deivi\\Desktop\\discord-rpc-master', '-DCMAKE_INSTALL_PREFIX=..\\install\\win32-dynamic', '-G', 'Visual Studio 14 2015', '-DBUILD_SHARED_LIBS=ON', '-DUSE_STATIC_CRT=ON', '-DCLANG_FORMAT_SUFFIX=none']' returned non-zero exit status 1.
...yes, the files from releases work. I assume you are on windows. Go to releases, and download discord-rpc-win.zip
. Inside of that is this folder structure.
Inside win64-dynamic
and win32-dynamic
are bin
folders. Inside those bin
folders are discord-rpc.dll
files for 32 and 64 bit windows. Those are the files to put in the Assets\Plugins
folder inside Unity. The DiscordRpc.cs
file from discord-rpc\examples\button-clicker\Assets
should be placed inside the Assets
folder of your Unity project. It's a header file to talk to the dll.
Oh maaan, thank you, I only looked into include and lib folders, because I opened bin folder in static version first, I thought it will be the same in dynamic
Haha, thank you now I figured it out!
I'm complete newb, and I don't know where to get the dll. Can someone help?