GithubHelp home page GithubHelp logo

focus-creative-games / hybridclr_unity Goto Github PK

View Code? Open in Web Editor NEW
665.0 18.0 118.0 13.94 MB

Unity package for HybridCLR

Home Page: https://code-philosophy.com/

License: MIT License

Shell 0.02% C# 99.89% C++ 0.09%
huatuo hybridclr il2cpp unity

hybridclr_unity's People

Contributors

alanliu90 avatar bian-sh avatar firleaves avatar ghzh26252 avatar newbiegamecoder avatar pirunxi avatar roland0511 avatar senfee-cheng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hybridclr_unity's Issues

在2022.3.11f1把Load texture data on demand选项选上后,编译会崩溃

Unity Editor版本: 2022.3.11f1, 2022.3.12f1
操作系统: Windows 11
出错的BuildTarget: Android
com.code-philosophy.hybridclr的版本号: 4.0.11, 4.0.12
复现条件:
1)把hybridclr_trial导入到2022.3.11f1,然后把hybridclr升级到4.0.12; 把编译选项切换到android平台
2)把ProjectSettings -> Editor的 -> Load texture data on demand选项 选上 后,运行GenerateAll步骤,unity会直接崩溃
如果这个选项没有选上,则正常

1D)LVTFBL4 Z7HHN93UTCG

Win64PC包游戏关闭时死循环的问题

我的项目在Win64的PC包下,退出游戏时有死循环卡住的问题,这个问题在我升级引擎之后出现(Unity 2021.3.1 -> Unity 2022.3.16), 使用的hybridCLR_unity版本为(v4.0.3 -> v4.0.15)

这是死循环的堆栈:
Snipaste_2024-01-09_00-48-54
貌似是os::Socket::Cleanup();里一直在循环,我使用的网络库是LitNetLib,不知道是不是这个库的socket处理导致的。

unity2021.3.1f1 WebGL平台 await UniTask报错

Unity Editor版本: 2021.3.1f1
操作系统: macOS Big Sur
出错的Build Target: WebGL
com.focus-creative-games.hybridclr_unity的版本号: 2.0.0
hybridclr仓库的版本号: main 531f98365eebce5d1390175be2b41c41e217d918
il2cpp_plus仓库的版本号: 2021-main 99cd1cbbfc1f637460379e81c9a7776cd3e662ad
截图及日志文件
image

image

复现条件 await UniTask报错,clone这个仓库https://gitee.com/poetao/hybridclr_test.git 直接打包webgl平台即可
出错的c#代码位置(如果能定位出的话)
image

Unity 2022.3.17.f1c1 + hybridclr_unity 5.0 使用UniTask会闪退。

Unity版本: 2022.3.17.f1.c1

hybridclr_unity 版本: 5.0

只要在热更代码里面调用UniTask 函数函数就会闪退

例如下面的这个非常简单的代码:

public async UniTask UniTaskTest()
{
       await Task.Delay(1000);
       Debug.LogError("UnitTask");
}

之前使用的hybirdclr版本是3.4.2, unity 版本是2022.3.7.f1c1 是没有问题,
升级unity到3.17f1c1之后,使用原来的hybirdclr版本(3.4.2)会出编译错误的问题,就将hybirdclr升级到了最新版本,
打包出来之后,游戏走到热更代码中unitask相关代码的时候就会闪退了,在IOS和Android上都会发生,
我创建了一个复现工程使用下面的代码作为热更代码

using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using UnityEngine;

public class GameApp 
{
  
    private static GameApp _instance;
    
    public static GameApp Instance
    {
        get
        {
            if (null == _instance)
            {
                _instance = new GameApp();
            }

            return _instance;
        }
    }
    
    //UniTask测试代码,执行到这里必定崩溃
    public async UniTask UniTaskTest()
    {
        await Task.Delay(1000);
        Debug.LogError("UnitTask");
    }
    
    //游戏热更代码入口
    
    public static void Entrance(object[] objects)
    {
        Debug.Log("Enter Entrance");
         
        Debug.Log("Start UniTaskTest");
        Instance.UniTaskTest().Forget();
    }
}

复现问题的工程

  1. 下载链接中的文件,使用unity2022.3.17 android平台打开;
  2. 打开hybirdclr install 安装hybirdclr 5.0
  3. 点击build ANDROID,打包apk,打包完成之后在工程目录下 AndroidExport中生成Trial_Issue.Apk了,
  4. 安装Trial_Issue.Apk 运行,运行过程中有显示LOG,执行Task函数是没有问题的,执行到Unitask就会闪退

加载多个热更新程序集相互之间调用异常

加载 A和B两个程序集,B里面对象继承A内的一个接口ISystem,在A里面利用反射创建这个对象时会导致强制类型转换失败

Type systemType; //这个类型是获取的继承ISystem的类 var constructorInfo = systemType.GetConstructor(System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public, null, new Type[0], null); object obj=constructorInfo.Invoke(null); ISystem typeInstance = (ISystem)obj;

会抛出类型转换失败的异常

CleanIl2CppBuildCache 被多线程调用,导致报错

执行Generate -> MethodBridge时,有概率出现下面的报错:

== output:E:\xxx\yyy\Client/HybridCLRData/LocalIl2CppData-WindowsEditor/il2cpp/libil2cpp/hybridclr/generated/MethodBridge_Arm64.cpp ==

== output:E:\xxx\yyy\Client/HybridCLRData/LocalIl2CppData-WindowsEditor/il2cpp/libil2cpp/hybridclr/generated/MethodBridge_Universal64.cpp ==

DirectoryNotFoundException: Could not find a part of the path 'E:\xxx\yyy\Client\Library\Il2cppBuildCache\Windows\x64\il2cppOutput\Data'.
System.IO.__Error.WinIOError (System.Int32 errorCode, System.String maybeFullPath) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.FileSystemEnumerableIterator`1[TSource].HandleError (System.Int32 hr, System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.FileSystemEnumerableIterator`1[TSource].CommonInit () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.FileSystemEnumerableIterator`1[TSource]..ctor (System.String path, System.String originalUserPath, System.String searchPattern, System.IO.SearchOption searchOption, System.IO.SearchResultHandler`1[TSource] resultHandler, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.FileSystemEnumerableFactory.CreateFileNameIterator (System.String path, System.String originalUserPath, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.InternalGetFileDirectoryNames (System.String path, System.String userPathOriginal, System.String searchPattern, System.Boolean includeFiles, System.Boolean includeDirs, System.IO.SearchOption searchOption, System.Boolean checkHost) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.InternalGetDirectories (System.String path, System.String searchPattern, System.IO.SearchOption searchOption) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.GetDirectories (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.RecursiveDelete (System.String path) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.IO.Directory.Delete (System.String path, System.Boolean recursive) (at <695d1cc93cca45069c528c15c9fdd749>:0)
HybridCLR.Editor.Commands.MethodBridgeGeneratorCommand.CleanIl2CppBuildCache () (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@eee3dbaa69/Editor/Commands/MethodBridgeGeneratorCommand.cs:28)
HybridCLR.Editor.Commands.MethodBridgeGeneratorCommand.GenerateMethodBridgeCppFile (HybridCLR.Editor.MethodBridge.Analyzer analyzer, HybridCLR.Editor.ABI.PlatformABI platform, System.String templateCode, System.String outputFile) (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@eee3dbaa69/Editor/Commands/MethodBridgeGeneratorCommand.cs:45)
HybridCLR.Editor.Commands.MethodBridgeGeneratorCommand+<>c__DisplayClass3_2.<GenerateMethodBridge>b__0 () (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@eee3dbaa69/Editor/Commands/MethodBridgeGeneratorCommand.cs:80)
System.Threading.Tasks.Task.InnerInvoke () (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Threading.Tasks.Task.Execute () (at <695d1cc93cca45069c528c15c9fdd749>:0)
Rethrow as AggregateException: One or more errors occurred.
System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks, System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks, System.Int32 millisecondsTimeout) (at <695d1cc93cca45069c528c15c9fdd749>:0)
System.Threading.Tasks.Task.WaitAll (System.Threading.Tasks.Task[] tasks) (at <695d1cc93cca45069c528c15c9fdd749>:0)
HybridCLR.Editor.Commands.MethodBridgeGeneratorCommand.GenerateMethodBridge (System.Boolean compileDll) (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@eee3dbaa69/Editor/Commands/MethodBridgeGeneratorCommand.cs:83)
HybridCLR.Editor.Commands.MethodBridgeGeneratorCommand.GenerateMethodBridge () (at Library/PackageCache/com.focus-creative-games.hybridclr_unity@eee3dbaa69/Editor/Commands/MethodBridgeGeneratorCommand.cs:51)


unity崩溃

unity 2022.3.10lts 导出插件后崩溃。

4.0.3 NotSupportNative2Managed

环境:
win10
unity2021.3.25f1c1
安卓64位包体
HybridCLR 4.0.3

在我们的项目中出现了个报错: ExecutionEngineException: NotSupportNative2Managed
最后通过排查是图中箭头所指处报错(InventoryType是枚举类型)(在3.4.2版本中是正常的)。
image

关于3.2版本 xcode工程打包给别的电脑使用的问题

大佬你好 我看文档说是
当 com.code-philosophy.hybridclr 版本 ≥ v3.2.0
不需要任何处理,直接导出xcode工程,再打包即可。由于在build完成后才将libil2cpp源码加入xcode工程,因此只能先导出xcode,再手动或者命令行编译,试图直接Build And Run会出错。

危险
由于xcode工程里写死了 libil2cpp相关代码的路径,如果你导出xcode工程,推送到其他电脑上打包,会出现代码文件找不到的错误!

那么就意味着如果我要出xcode工程给别人的话就不能使用高版本了 还是说大佬以后会支持多种选择 可以选择还是采用原始的自己编译.a的方式

il2cpp打包报错

不好意思 请问一下最近打包遇到了 il2cpp redifination xxxxx的报错,il2cpp生成的ZeusCore_Attr.cpp 定义了两个同样的方法ByteBufferAllocator_t0E319F952878FBAB0B83EF60D2A5BC7C3ED5F5C8_CustomAttributesCacheGenerator_A

反编译自己的dll之后发现dll中自动生成了名字相同的变量
private int A;
private byte[] A;,
而我的代码在编译成dll之前是一个访问器
public int a {get;protected set;}
public byte[] b {get;protected set;} 并没有修改的空间,且原生il2cpp并不会造成打包报错。

请问这种情况怎么解决?(unity版本2020.3.33,hybrid_unitypackage 已经更到最新)

ValueTypeSizeAligmentCalculator.cs not accounting for FieldOffset if ClassLayout is null

We have some structs where the method bridge generation code was calculating a different size than the runtime code was. So we were getting some missing method bridge errors at runtime when we ran the hot loaded code. The problem was that the structs have FieldOffset attributes and ExplicitLayout, but the code in ValueTypeSizeAligmentCalculator.cs wasn’t accounting for it. The struct’s TypeDef had a null ClassLayout so it never entered the section of code that checks the FieldOffset.

To work around this, I removed the check for (sa != null) so that the size calculation code will check the FieldOffset value even if the ClassLayout is null.

Here are the details asked for in the bug report template:
Unity version: 2021.3.1f1
Operating system: Windows 10
Target: Windows
Version of com.focus-creative-games.hybridclr_unity: 0.9.0
Version of hybridclr and il2cpp_plus: Version that goes with the 0.9.0 package, from about a month ago. However, the code where I found the problem is the same in the latest versions of HybridCLR.

Code location:
com.focus-creative-games.hybridclr_unity\Editor\ABI\ValueTypeSizeAligmentCalculator.cs
SizeAndAligmentOfStruct function
Line 78

Please let me know if I can provide any more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.