# open-im-sdk-unity **Repository Path**: github_repo/open-im-sdk-unity ## Basic Information - **Project Name**: open-im-sdk-unity - **Description**: No description available - **Primary Language**: Unknown - **License**: AGPL-3.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-09 - **Last Updated**: 2026-04-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Unity Client SDK for OpenIM ๐Ÿ‘จโ€๐Ÿ’ป๐Ÿ’ฌ Use this SDK to add instant messaging capabilities to your Unity Game. By connecting to a self-hosted [OpenIM](https://www.openim.online/) server, you can quickly integrate instant messaging capabilities into your app with just a few lines of code. The underlying SDK core is implemented in [openim-sdk-cpp](https://github.com/openimsdk/openim-sdk-cpp/tree/unity). ## Documentation ๐Ÿ“š Visit [https://docs.openim.io/](https://docs.openim.io/) for detailed documentation and guides. For the SDK reference, see [https://docs.openim.io/sdks/quickstart/unity](https://docs.openim.io/sdks/quickstart/unity). ## Installation ๐Ÿ’ป ### Adding Unity Package 1. Add SDK package via git url ``` https://github.com/openimsdk/open-im-sdk-unity.git ``` ## Usage ๐Ÿš€ The following examples demonstrate how to use the SDK. ### Importing the SDK and initialize ```C# using OpenIM.IMSDK.Unity; using OpenIM.IMSDK.Unity.Listener; ``` ### Initialize ```C# var config = new IMConfig() { PlatformID = (int)PlatformID.WindowsPlatformID, ApiAddr = apiAddr, WsAddr = wsAddr, DataDir = Path.Combine(Application.persistentDataPath, "OpenIM"), LogLevel = (int)LogLevel.Debug, IsLogStandardOutput = true, LogFilePath = Path.Combine(Application.persistentDataPath, "OpenIM/Logs"), IsExternalExtensions = false, }; var suc = IMSDK.InitSDK(config, new ConnListener()); ``` ### Set Listener > Note1: You need to set up the listeners first and then log in. ```C# IMSDK.SetConversationListener(IConversationListener l); IMSDK.SetGroupListener(IGroupListener l); IMSDK.SetFriendShipListener(IFriendShipListener l); IMSDK.SetFriendShipListener(IFriendShipListener l); IMSDK.SetAdvancedMsgListener(IAdvancedMsgListener l); IMSDK.SetUserListener(IUserListener l); IMSDK.SetBatchMsgListener(IBatchMsgListener l) ``` ### Login ```C# var status = IMSDK.GetLoginStatus(); if (status == LoginStatus.Empty || status == LoginStatus.Logout) { IMSDK.Login(userId, token, (suc, err, errMsg) => { if (suc) { Debug.Log("Login UserId:" + IMSDK.GetLoginUserId()); GetData(); } else { { Debug.Log("Login Failed :" + errMsg); } } }); } else if (status == LoginStatus.Logged) { Debug.Log("Login UserId:" + IMSDK.GetLoginUserId()); GetData(); } ``` ### Logout ```C# // Log out the currently logged in user IMSDK.Logout((suc,err,errMsg)=>{ }) // exit sdk IMSDK.UnInitSDK(); ``` To log into the IM server, you need to create an account and obtain a user ID and token. Refer to the [access token documentation](https://docs.openim.io/restapi/apis/userManagement/userRegister) for details. ## Examples ๐ŸŒŸ You can find a demo that uses the SDK in the [open-im-unity-demo](https://github.com/openimsdk/open-im-unity-demo.git) repository. ## Community :busts_in_silhouette: - ๐Ÿ“š [OpenIM Community](https://github.com/OpenIMSDK/community) - ๐Ÿ’• [OpenIM Interest Group](https://github.com/Openim-sigs) - ๐Ÿš€ [Join our Slack community](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) - :eyes: [Join our wechat (ๅพฎไฟก็พค)](https://openim-1253691595.cos.ap-nanjing.myqcloud.com/WechatIMG20.jpeg) ## Community Meetings :calendar: We want anyone to get involved in our community and contributing code, we offer gifts and rewards, and we welcome you to join us every Thursday night. Our conference is in the [OpenIM Slack](https://join.slack.com/t/openimsdk/shared_invite/zt-22720d66b-o_FvKxMTGXtcnnnHiMqe9Q) ๐ŸŽฏ, then you can search the Open-IM-Server pipeline to join We take notes of each [biweekly meeting](https://github.com/orgs/OpenIMSDK/discussions/categories/meeting) in [GitHub discussions](https://github.com/openimsdk/open-im-server/discussions/categories/meeting), Our historical meeting notes, as well as replays of the meetings are available at [Google Docs :bookmark_tabs:](https://docs.google.com/document/d/1nx8MDpuG74NASx081JcCpxPgDITNTpIIos0DS6Vr9GU/edit?usp=sharing). ## Who are using OpenIM :eyes: Check out our [user case studies](https://github.com/OpenIMSDK/community/blob/main/ADOPTERS.md) page for a list of the project users. Don't hesitate to leave a [๐Ÿ“comment](https://github.com/openimsdk/open-im-server/issues/379) and share your use case. ## License :page_facing_up: This software is licensed under a dual-license model: - The GNU Affero General Public License (AGPL), Version 3 or later; **OR** - Commercial license terms from OpenIMSDK. If you wish to use this software under commercial terms, please contact us at: contact@openim.io For more information, see: https://www.openim.io/en/licensing