Search code examples
c++unity-game-engineserver

C++ GamerServer Library with Unity Client


I made a simple C++ game server library(network session) and I wanted to use it for Unity client to make a simple MMORPG.

I found that my library needs to be changed to DLL. So, I made a dll of my C++ game server library and found that my class cannot be used for Unity Client directly.

Is there an easy way to use my c++ library class for Unity Client?

I hope your wise answers.

Thank you for reading.


Solution

  • You are trying to create a Unity native plugin. You have to make sure that you export your methods in the proper way and then you can "link" them to a C# method that will have the same signature. Tip: make sure to keep with the native/primitive types. Since it is a long topic to be explained here I am sharing a link that will help you:

    Working with Native Plugins from Unity: https://learn.unity.com/tutorial/working-with-native-plugins-2019-3