{"id":29102381,"url":"https://github.com/wechat-miniprogram/minigame-unity-wechat-preview","last_synced_at":"2026-02-18T15:01:03.570Z","repository":{"id":284324672,"uuid":"913626153","full_name":"wechat-miniprogram/minigame-unity-wechat-preview","owner":"wechat-miniprogram","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-25T09:29:45.000Z","size":46,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-28T21:52:11.464Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wechat-miniprogram.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-08T03:45:03.000Z","updated_at":"2025-06-03T06:04:22.000Z","dependencies_parsed_at":"2025-03-25T10:42:40.799Z","dependency_job_id":null,"html_url":"https://github.com/wechat-miniprogram/minigame-unity-wechat-preview","commit_stats":null,"previous_names":["wechat-miniprogram/minigame-unity-wechat-preview"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wechat-miniprogram/minigame-unity-wechat-preview","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fminigame-unity-wechat-preview","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fminigame-unity-wechat-preview/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fminigame-unity-wechat-preview/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fminigame-unity-wechat-preview/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wechat-miniprogram","download_url":"https://codeload.github.com/wechat-miniprogram/minigame-unity-wechat-preview/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wechat-miniprogram%2Fminigame-unity-wechat-preview/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29582787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T13:56:48.962Z","status":"ssl_error","status_checked_at":"2026-02-18T13:54:34.145Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-28T21:45:02.897Z","updated_at":"2026-02-18T15:01:03.556Z","avatar_url":"https://github.com/wechat-miniprogram.png","language":null,"readme":"# **快适配小游戏预览插件**\n\n## **背景**\n\n​\t为了为开发者提供无需转换即可预览WXSDK效果的支持，推出了基于`WebRTC`音视频与数据传输的`WeChat Preview`插件。\n\n## 依赖\n\n- **Newtonsoft Json: `3.2.1`**\n- **WebRTC: `3.0.0-pre.6`**\n- **Unity Render Streaming: `3.1.0-exp.7`**\n- **Input System: `1.5.1`**\n- **WXSDK: `v0.1.25以上`** \n\n## 使用方法\n\n1. 创建Unity新项目或打开现有项目（Unity版本需\u003e=`2020.3`）\n2. `Window——Package Manager——Add package form git URL...`，输入`https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git`导入微信小游戏转换插件。\n3. `Window——Package Manager——Add package form git URL...`，输入`https://github.com/wechat-miniprogram/minigame-unity-wechat-preview.git`导入预览插件。\n4. 可能会弹出首次使用`input system`的弹窗，点选`Yes`重启Editor。\n5. 确保`Unity Editor`所在设备与预览设备处于同一局域网下（内网可能有网络限制，若无法连接可以使用移动热点）。\n6. 打开`微信小游戏——在微信中预览`，并按需配置选项。\n7. 点击`开始运行`，而后使用微信开发者工具打开点击出现的按钮`打开本地预览包位置`所打开的文件夹（appid为自配置）或直接使用手机扫描出现的小程序码（appid为快适配示例）即可预览。\n\n## 预览选项\n\n1. 本地预览包选项\n\n   - APPID：生成的本地预览包所使用的APPID。\n\n   - 导出路径：本地预览包的生成位置。\n2. 视频选项\n\n   - 预览方向：默认为`Portrait`。`Portrait`为竖屏预览，`Landscape`为横屏预览。\n\n   - 帧率：默认最大帧率30帧。\n\n   - 视频码率：默认为0～10000kbits/sec。最小/最大值范围为0～10000kbits/sec。\n\n   - 分辨率缩小倍数：默认为`No Scale`。提高缩小倍数可以使预览视频更流畅，但视频质量会更差。\n\n   - 显示触摸位置：默认为false。打开后可以实时显示预览输入的触摸位置。\n3. 音频选项\n\n   - 音频源类型：默认为`APIOnly`。**注意：`AudioSourceName`/`AudioListenerName`输入的是AudioSource/AudioListener所挂载的GameObject的名称。**\n\n     - `APIOnly`：只传输由API触发的音频。\n\n     - `AudioSource`：由`AudioSourceName`指定一个AudioSource，只传输该AudioSource生成的音频。\n\n     - `AudioListener`：由`AudioListenerName`指定一个AudioListener，只传输该AudioListener接收的音频。\n\n   - 音频码率：默认为0～1000kbits/sec。最小/最大值范围为0～1000kbits/sec。\n4. 网络选项\n   - IP：会自动列出本机IP地址列表，需要选择与预览设备处于相同网络的IP地址。**更改本机网络环境后Windows平台下需要手动刷新IP列表。**\n\n## 注意事项\n\n1. **插件提供对`Input System`输入的完全支持与对`InputManager`输入的部分支持。**\n   1. **使用`Input System`输入时，确保`Event System`上挂载了`InputSystemUIInputModule`**\n   2. **使用`InputManager`输入时，需使用`WeChat Preview/Runtime/PreviewInputModule`替换掉`Standalone Input Module`**\n\n2. **插件提供对部分WXSDK的支持，详见下文已支持API。**\n\n3. **插件提供对排行榜的部分支持，仅对新版排行榜（ScreenCanvas模式）提供支持。新版排行榜的使用方式详见[文档](https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/OpenData.html)与[排行榜Demo](https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/tree/main/Demo/Ranking)**。\n\n4. **音频源类型选择`AudioSource`/`AudioListener`时，`AudioSourceName`/`AudioListenerName`输入的是AudioSource/AudioListener所挂载的GameObject的名称。**\n\n5. **Windows平台下，网络环境变化时需要手动刷新IP列表。**\n\n6. **`Render Streaming`运行环境未修复时，点击开始运行会进行环境修复，需要等待编译完成后再次点击开始运行。**\n\n7. **MacOS M系列芯片暂不支持预览安卓设备。**\n\n## 已支持API\n\n|                     API                     |          备注          |\n| :-----------------------------------------: | :--------------------: |\n|           SetMessageToFriendQuery           |   预览环境下始终返回true  |\n|           GetAppAuthorizeSetting            |                        |\n|                GetWindowInfo                |                        |\n|              GetSystemSetting               |                        |\n|              GetSystemInfoSync              |                        |\n|       GetMenuButtonBoundingClientRect       |                        |\n|            GetLaunchOptionsSync             |                        |\n|             GetEnterOptionsSync             |                        |\n|                GetDeviceInfo                |                        |\n|               GetAppBaseInfo                |                        |\n|                                             |                        |\n|                   AddCard                   |                        |\n|             AuthPrivateMessage              |                        |\n|                  Authorize                  |                        |\n|         CheckIsAddedToMyMiniProgram         |                        |\n|                CheckSession                 |                        |\n|                 ChooseImage                 |                        |\n|                 ChooseMedia                 |                        |\n|              ChooseMessageFile              |                        |\n|             CloseBLEConnection              |                        |\n|            CloseBluetoothAdapter            |                        |\n|                CompressImage                |                        |\n|             CreateBLEConnection             |                        |\n|          CreateBLEPeripheralServer          |                        |\n|               ExitMiniProgram               |                        |\n|                ExitVoIPChat                 |                        |\n|                 FaceDetect                  |                        |\n|          GetAvailableAudioSources           |                        |\n|         GetBLEDeviceCharacteristics         |                        |\n|              GetBLEDeviceRSSI               |                        |\n|            GetBLEDeviceServices             |                        |\n|                  GetBLEMTU                  |                        |\n|           GetBackgroundFetchData            |                        |\n|           GetBackgroundFetchToken           |                        |\n|               GetBatteryInfo                |                        |\n|                 GetBeacons                  |                        |\n|          GetBluetoothAdapterState           |                        |\n|             GetBluetoothDevices             |                        |\n|             GetChannelsLiveInfo             |                        |\n|          GetChannelsLiveNoticeInfo          |                        |\n|              GetClipboardData               |                        |\n|        GetConnectedBluetoothDevices         |                        |\n|           GetDeviceBenchmarkInfo            |                        |\n|                GetExtConfig                 |                        |\n|              GetFuzzyLocation               |                        |\n|               GetGameClubData               |                        |\n|              GetGroupEnterInfo              |                        |\n|             GetInferenceEnvInfo             |                        |\n|              GetLocalIPAddress              |                        |\n|               GetNetworkType                |                        |\n|               GetPhoneNumber                |                        |\n|              GetPrivacySetting              |                        |\n|             GetScreenBrightness             |                        |\n|           GetScreenRecordingState           |                        |\n|                 GetSetting                  |                        |\n|                GetShareInfo                 |                        |\n|               GetStorageInfo                |                        |\n|                GetSystemInfo                |                        |\n|             GetSystemInfoAsync              |                        |\n|                 GetUserInfo                 |                        |\n|          GetUserInteractiveStorage          |                        |\n|                GetWeRunData                 |                        |\n|                HideKeyboard                 |                        |\n|                 HideLoading                 |                        |\n|                HideShareMenu                |                        |\n|                  HideToast                  |                        |\n|               InitFaceDetect                |                        |\n|           IsBluetoothDevicePaired           |                        |\n|                JoinVoIPChat                 |                        |\n|                    Login                    |                        |\n|              MakeBluetoothPair              |                        |\n|           NavigateBackMiniProgram           |                        |\n|            NavigateToMiniProgram            |                        |\n|     NotifyBLECharacteristicValueChange      |                        |\n|           OpenAppAuthorizeSetting           |                        |\n|            OpenBluetoothAdapter             |                        |\n|                  OpenCard                   |                        |\n|            OpenChannelsActivity             |                        |\n|              OpenChannelsEvent              |                        |\n|              OpenChannelsLive               |                        |\n|           OpenChannelsUserProfile           |                        |\n|           OpenCustomerServiceChat           |                        |\n|       OpenCustomerServiceConversation       |                        |\n|             OpenPrivacyContract             |                        |\n|                 OpenSetting                 |                        |\n|         OpenSystemBluetoothSetting          |                        |\n|                PreviewImage                 |                        |\n|                PreviewMedia                 |                        |\n|         ReadBLECharacteristicValue          |                        |\n|                RemoveStorage                |                        |\n|           RemoveUserCloudStorage            |                        |\n|                 ReportScene                 |                        |\n|          RequestMidasFriendPayment          |                        |\n|             RequestMidasPayment             |                        |\n|         RequestMidasPaymentGameItem         |                        |\n|           RequestSubscribeMessage           |                        |\n|        RequestSubscribeSystemMessage        |                        |\n|           RequirePrivacyAuthorize           |                        |\n|             RestartMiniProgram              |                        |\n|               SaveFileToDisk                |                        |\n|           SaveImageToPhotosAlbum            |                        |\n|                  ScanCode                   |                        |\n|                  SetBLEMTU                  |                        |\n|           SetBackgroundFetchToken           |                        |\n|              SetClipboardData               |                        |\n|            SetDeviceOrientation             |                        |\n|               SetEnableDebug                |                        |\n|             SetInnerAudioOption             |                        |\n|               SetKeepScreenOn               |                        |\n|                SetMenuStyle                 |                        |\n|             SetScreenBrightness             |                        |\n|              SetStatusBarStyle              |                        |\n|             SetUserCloudStorage             |                        |\n|          SetVisualEffectOnCapture           |                        |\n|               ShowActionSheet               |                        |\n|                ShowKeyboard                 |                        |\n|                 ShowLoading                 |                        |\n|                  ShowModal                  |                        |\n|             ShowShareImageMenu              |                        |\n|                ShowShareMenu                |                        |\n|                  ShowToast                  |                        |\n|             StartAccelerometer              |                        |\n|            StartBeaconDiscovery             |                        |\n|       StartBluetoothDevicesDiscovery        |                        |\n|                StartCompass                 |                        |\n|         StartDeviceMotionListening          |                        |\n|              StopAccelerometer              |                        |\n|             StopBeaconDiscovery             |                        |\n|        StopBluetoothDevicesDiscovery        |                        |\n|                 StopCompass                 |                        |\n|          StopDeviceMotionListening          |                        |\n|               StopFaceDetect                |                        |\n|               UpdateKeyboard                |                        |\n|               UpdateShareMenu               |                        |\n|          UpdateVoIPChatMuteConfig           |                        |\n|               UpdateWeChatApp               |                        |\n|                 VibrateLong                 |                        |\n|                VibrateShort                 |                        |\n|         WriteBLECharacteristicValue         |                        |\n|                StartGameLive                |                        |\n|            CheckGameLiveEnabled             |                        |\n|         GetUserCurrentGameliveInfo          |                        |\n|          GetUserRecentGameLiveInfo          |                        |\n|           GetUserGameLiveDetails            |                        |\n|         OpenChannelsLiveCollection          |                        |\n|                  OpenPage                   |                        |\n|        RequestSubscribeLiveActivity         |                        |\n|              OpenBusinessView               |                        |\n|                                             |                        |\n|               ExitPointerLock               |                        |\n|          OperateGameRecorderVideo           |                        |\n|              RemoveStorageSync              |                        |\n|                 ReportEvent                 |                        |\n|              ReportPerformance              |                        |\n|      ReportUserBehaviorBranchAnalytics      |                        |\n|             RequestPointerLock              |                        |\n|             ReserveChannelsLive             |                        |\n|               RevokeBufferURL               |                        |\n|               SetStorageSync                |                        |\n|               ShareAppMessage               |                        |\n|                  TriggerGC                  |                        |\n|                                             |                        |\n|            OnAccelerometerChange            |                        |\n|           OffAccelerometerChange            |                        |\n|          OnAudioInterruptionBegin           |                        |\n|          OffAudioInterruptionBegin          |                        |\n|           OnAudioInterruptionEnd            |                        |\n|           OffAudioInterruptionEnd           |                        |\n|         OnBLEConnectionStateChange          |                        |\n|         OffBLEConnectionStateChange         |                        |\n|               OnBLEMTUChange                |                        |\n|               OffBLEMTUChange               |                        |\n|    OnBLEPeripheralConnectionStateChanged    |                        |\n|   OffBLEPeripheralConnectionStateChanged    |                        |\n|            OnBackgroundFetchData            |                        |\n|            OnBeaconServiceChange            |                        |\n|           OffBeaconServiceChange            |                        |\n|               OnBeaconUpdate                |                        |\n|               OffBeaconUpdate               |                        |\n|        OnBluetoothAdapterStateChange        |                        |\n|       OffBluetoothAdapterStateChange        |                        |\n|           OnBluetoothDeviceFound            |                        |\n|           OffBluetoothDeviceFound           |                        |\n|               OnCompassChange               |                        |\n|              OffCompassChange               |                        |\n|            OnDeviceMotionChange             |                        |\n|            OffDeviceMotionChange            |                        |\n|          OnDeviceOrientationChange          |                        |\n|         OffDeviceOrientationChange          |                        |\n|                   OnError                   |                        |\n|                  OffError                   |                        |\n|                   OnHide                    |                        |\n|                   OffHide                   |                        |\n|        OnInteractiveStorageModified         |                        |\n|        OffInteractiveStorageModified        |                        |\n|                  OnKeyDown                  |                        |\n|                 OffKeyDown                  |                        |\n|                   OnKeyUp                   |                        |\n|                  OffKeyUp                   |                        |\n|             OnKeyboardComplete              |                        |\n|             OffKeyboardComplete             |                        |\n|              OnKeyboardConfirm              |                        |\n|             OffKeyboardConfirm              |                        |\n|           OnKeyboardHeightChange            |                        |\n|           OffKeyboardHeightChange           |                        |\n|               OnKeyboardInput               |                        |\n|              OffKeyboardInput               |                        |\n|               OnMemoryWarning               |                        |\n|              OffMemoryWarning               |                        |\n| OnMenuButtonBoundingClientRectWeightChange  |                        |\n| OffMenuButtonBoundingClientRectWeightChange |                        |\n|                  OnMessage                  |                        |\n|                 OnMouseDown                 |                        |\n|                OffMouseDown                 |                        |\n|                 OnMouseMove                 |                        |\n|                OffMouseMove                 |                        |\n|                  OnMouseUp                  |                        |\n|                 OffMouseUp                  |                        |\n|            OnNetworkStatusChange            |                        |\n|           OffNetworkStatusChange            |                        |\n|             OnNetworkWeakChange             |                        |\n|            OffNetworkWeakChange             |                        |\n|        OnScreenRecordingStateChanged        |                        |\n|       OffScreenRecordingStateChanged        |                        |\n|           OnShareMessageToFriend            |                        |\n|                   OnShow                    |                        |\n|                   OffShow                   |                        |\n|            OnUnhandledRejection             |                        |\n|            OffUnhandledRejection            |                        |\n|             OnUserCaptureScreen             |                        |\n|            OffUserCaptureScreen             |                        |\n|            OnVoIPChatInterrupted            |                        |\n|           OffVoIPChatInterrupted            |                        |\n|          OnVoIPChatMembersChanged           |                        |\n|          OffVoIPChatMembersChanged          |                        |\n|          OnVoIPChatSpeakersChanged          |                        |\n|         OffVoIPChatSpeakersChanged          |                        |\n|           OnVoIPChatStateChanged            |                        |\n|           OffVoIPChatStateChanged           |                        |\n|                   OnWheel                   |                        |\n|                  OffWheel                   |                        |\n|               OnWindowResize                |                        |\n|               OffWindowResize               |                        |\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fminigame-unity-wechat-preview","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwechat-miniprogram%2Fminigame-unity-wechat-preview","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwechat-miniprogram%2Fminigame-unity-wechat-preview/lists"}