Skip to content

Commit

Permalink
更新文档
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed Apr 3, 2024
1 parent bc6ae02 commit 7353546
Show file tree
Hide file tree
Showing 4 changed files with 244 additions and 318 deletions.
17 changes: 2 additions & 15 deletions docs/basic/supportedplatformanduniyversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,16 @@ HybridCLR已经稳定支持了2019.4.x、2020.3.x、2021.3.x、2022.3.x 系列LT
- MacOS arm64(silicon)
- Android armv7、armv8(arm64)
- iOS arm64
- tvOS
- WebGL 标准WebGL、MiniGame、微信小游戏
- PS4、PS5
- UWP
- 华为Harmony(鸿蒙)平台(当前只有团结引擎支持鸿蒙)

以下是理论支持,但实践中有可能残留小bug的平台:

- tvOS
- 其他平台

## 团结引擎

已经支持团结引擎。由于版权原因社区版本我们不公开支持团结引擎的分支,需要使用贵公司邮箱联系business@code-philosophy.com,附带介绍项目情况(项目名称、项目类型之类的信息),同时在邮件中`承诺不公开或者向除本项目以外的其他公司或个人分享这些资料信息`,可免费获得团结引擎支持相关的指导资料。

社区版本只支持2022.3.2t3版本的团结引擎,不再持续合并自`com.code-philosophy.hybridclr` 4.0.16及后版本的改动,需要使用者自己手动合并主线的改动。

也可以使用第三方制作的支持团结引擎的hybridclr版本 [HybridCLRTuanjieConv](https://gitee.com/ldr123/hybrid-clrtuanjie-conv)

:::tip

需要长期获得团结引擎相关的稳定支持,请购买商业化版本。

:::
自v5.2.0版本起,社区版本正式支持团结引擎,使用方式与Unity官方版本完全相同。

## 特殊说明

Expand Down
83 changes: 9 additions & 74 deletions docs/help/commonerrors.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,15 @@ Wrapper函数不足。你需要为热更新中的添加了MonoPInvokeCallback特

hybridclr与dots不兼容导致,商业化版本可以解决这个问题。

## WebGL 运行时出现 function signature mismatch错误

WebGL平台打包时默认使用 `faster (smaller) build`选项,该选项会开启完全泛型共享,而社区版本必须补充元数据后才能与完全泛型共享机制配合工作。解决办法:

1. 先尝试补充元数据,补充`函数栈最顶部的c#代码所在的`程序集
1. 如果补充元数据后仍然有问题,将 `Player Settings``IL2CPP Code Generation` 切换到 `Faster Runtime`
1. 如果仍然有问题,升级到最新的hybridclr版本
1. 如果还有问题,请联系我们技术支持

### 使用 Unity.netcode.runtime 后出现 NotSupportNative2Managed 桥接函数缺失异常

原因是 在Unity.netcode.runtime.dll中 NetworkManager.RpcReceiveHandler 是internal, 定义如下
Expand All @@ -448,80 +457,6 @@ internal delegate void RpcReceiveHandler(NetworkBehaviour behaviour, FastBufferR
处理函数,并且引用了 internal 的RpcReceiveHandler类!居然没报错。 导致出现桥接函数缺失的问题。


原始代码如下。

```csharp

public class NetworkPlayer : NetworkBehaviour
{

public static string msgFromHost;
public static string msgFromClient;


[ClientRpc]
public void SendMsgClientRpc(string msgFromHost)
{
NetworkPlayer.msgFromHost = msgFromHost;
}


[ServerRpc]
public void SendMsgServerRpc(string msgFromClient)
{
NetworkPlayer.msgFromClient = msgFromClient;
}
}

```


打包时生成的代码添加了几个函数,如下。

```csharp
public class NetworkPlayer : NetworkBehaviour
{
public static string msgFromHost;

public static string msgFromClient;

[ClientRpc]
public void SendMsgClientRpc(string msgFromHost)
{
// ...
}

[ServerRpc]
public void SendMsgServerRpc(string msgFromClient)
{
// ...
}

static NetworkPlayer()
{
// NetworkManager.__rpc_func_table 在自己的代码里是无法访问的!因为它是internal
NetworkManager.__rpc_func_table.Add(3066788814u, __rpc_handler_3066788814);
NetworkManager.__rpc_func_table.Add(901396020u, __rpc_handler_901396020);
}

private static void __rpc_handler_3066788814(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
// ...
}

private static void __rpc_handler_901396020(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
// ...
}

internal override string __getTypeName()
{
return "NetworkPlayer";
}
}

```

解决办法为你在AOT工程里也定义一个相同签名的delegate。

```csharp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ The following platforms have been tested for a long time and are very stable and
- WebGL standard WebGL, MiniGame, WeChat mini games
- PS4, PS5
- UWP

The following is a platform with theoretical support, but small bugs may remain in practice:

- tvOS
- other platforms

Expand Down
Loading

0 comments on commit 7353546

Please sign in to comment.