我一直在尝试创建一个UWP类库,使我可以访问Windows 10s本机功能,例如Windows.Security.Authentication.OnlineId.我想从设备获取用户名和ID,以便在Unity UWP IL2CPP项目中使用.我目前能够使用Unity内置的ios社交类进行此操作,谷歌编写的代码允许它与同一类无缝地工作,但是用于Android的Google Play游戏.
我已经从github上下载了一个示例(https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WebAccountManagement),它演示了如何在UWP应用程序中调用相关的类和函数,并且运行良好但是样本似乎是从"Windows.Foundation.UniversalApiContract"类访问类.
我似乎无法找到将其添加到基本UWP类库的方法,因此我可以调用所需的类,如Windows :: Security :: Credentials :: WebAccountProvider.
我能做的最好的事情是在类库中创建一个基本函数,它返回一个小的硬编码字符串,以测试该概念是否可以远程实现.: -
extern "C" __declspec(dllexport) wchar_t* __stdcall GetMyString()
{
wchar_t* myString = L"Guuuper";
auto resultBufferLength = wcslen(myString) + 1;
wchar_t* result = static_cast<wchar_t*>(CoTaskMemAlloc(resultBufferLength * sizeof(wchar_t)));
wcscpy_s(result, resultBufferLength, myString);
return result;
}
Run Code Online (Sandbox Code Playgroud)
我在尝试这样做的整个过程可以在这里找到: - http://forum.unity3d.com/threads/returning-c-string-to-il2cpp-windows-store-project.395284/
我已经能够通过UWP构建成功地从统一内部调用此代码,但我的主要问题是如何添加适当的引用或如何创建此类库来访问WebAccountProvider类?
任何帮助将非常感激
更新:我已经向他们自己网站的MS团队询问了这个挑战,他们似乎正在研究解决方案.
我正在尝试让我的iOS游戏为iOS构建.我将脚本后端设置为IL2CPP(armv7和arm64),我收到以下错误..
我用MobileMoveScript Plugin 2.1.3
和Mobile Social Plugin 6.6
.我不认为插件有任何问题,因为我已经尝试单独构建它们并且它有效.
运行失败
/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper2/UnusedBytecodeStripper2.exe -out"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data/Managed"-l none -c link -x"/Applications/Unity/Unity.app/Contents/Frameworks/Tools/UnusedByteCodeStripper/native_link.xml"-f"/Applications/Unity/Unity.app/Contents/Frameworks/il2cpp/LinkerDescriptors"-x"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data/Managed /../ platform_native_link.xml"-x"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data/methods_pointedto_by_uievents.xml"-x"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Assets/link.xml"-d"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data /管理"-a"/ Users/abeltherock007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data/Managed/Assembly-CSharp.dll"-a"/ Users/abeltherock 007/Documents/Unity Projects/Talking Superstar 2/Temp/StagingArea/Data/Managed/UnityEngine.UI.dll"
标准输出; Mono CIL Linker Mono.Cecil.AssemblyResolutionException中的致命错误:无法解析程序集:Mono.Linker.LinkContext.Resolve(IMetadataScope范围)[0x00000]中的'U3DXTCore,Culture = neutral,PublicKeyToken = null':Mono.Linker中的0 .Steps.ResolveFromXmlStep.GetAssembly(Mono.Linker.LinkContext context,System.String assemblyName)[0x00000] in:0 at Mono.Linker.Steps.ResolveFromXmlStep.ProcessAssemblies(Mono.Linker.LinkContext context,System.Xml.XPath.XPathNodeIterator迭代器)[0x00000] in:0 at Mono.Linker.Steps.ResolveFromXmlStep.Process()[0x00000] in:0 at Mono.Linker.Steps.BaseStep.Process(Mono.Linker.LinkContext context)[0x00000] in:0在Mono.Linker.Pipeline.Process(Mono.Linker.LinkContext context)[0x00000] in:0 at Mono.Linker.Driver.Run()[0x00000] in:0 at …
IL2CPP是 Unity 开发的脚本后端,您可以在为某些平台构建项目时将其用作 Mono 的替代。注意 - IL2CPP 仅在为以下平台构建时可用:
我有一个项目(unity 5.2)已切换为 Android 部署。我试图将我的脚本从 Mono2x 切换到 IL2CPP,它向我展示了
Andriod 上的 IL2CPP 是实验性的,不受支持
所以,我的简单问题是,如果它仍然不受支持,那么为什么包含该选项,IL2CPP 和 Mono2x 之间的根本区别是什么。为什么我切换到 IL2CPP 脚本后端?
我还检查了 unity 5.5.2 在 Windows 平台部署中没有 IL2CPP 选项。
我最近使用Il2CppDumper-v6.7.6反编译了我们当中的GameAssembly.dll
我的问题是,虽然我使用dnSpy打开文件Assembly-CSharp.dll,但所有方法/函数都是空的,如下所示,
有谁知道我如何解决这个问题并查看方法/功能?
将 Unity 2017.4.34f1 (LTS)与IL2CPP与NDK r13b 一起使用,我尝试将我的 Unity 项目导出到 Android 项目(构建过程)。
注意:我使用 IL2CPP 是因为 Google PlayStore 需要 32 位和 64 位,所以我不能再使用Mono作为脚本后端。
但是,它失败了,我收到以下错误:
Exception: C:\Program Files\Unity\Hub\Editor\2017.4.34f1\Editor\Data\il2cpp/build/il2cpp.exe did not run properly!
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:130)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1 setupStartInfo) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:73)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1 arguments, System.Action`1 setupStartInfo, System.String workingDirectory) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:336)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (ICollection`1 userAssemblies, System.String outputDirectory, System.String workingDirectory) (at …
Run Code Online (Sandbox Code Playgroud) 我正在尝试更新我们基于 ARToolkit5 的 Unity Android 应用程序,该应用程序已在 Google Play 商店中存在多年。ARToolkit5 不再受支持,但我们仍然依赖它大约 4 年前构建的库。我的Unity版本是2020.1.11f1。
我需要将应用程序升级到 Google App Bundle 并添加 64 位支持。因此,据我了解,第一步是从 Mono 更改为 IL2CPP 作为脚本后端。32 位 Android ARMv7 应用程序在 Mono 中构建并运行良好,但当我实际上只进行一项更改(即在项目设置下切换为 IL2CPP 作为脚本后端)时,构建失败。我什至还没有尝试添加 ARM64 选项。
使用 IL2CPP 时,构建失败并BuilderFailedException
显示数百个Undefined References
...
Exception: /Applications/2020.1.11f1/Unity.app/Contents/il2cpp/build/deploy/net471/il2cpp.exe did not run properly!
Failed running "/Applications/2020.1.11f1/Unity.app/Contents/il2cpp/build/deploy/net471/il2cpp.exe" --convert-to-cpp --emit-null-checks --enable-array-bounds-check --dotnetprofile="unityaot" --compile-cpp --libil2cpp-static --platform="Android" --architecture="ARMv7" --configuration="Release" --outputpath="<redacted>/Temp/StagingArea/assets/bin/Data/Native/armeabi-v7a/libil2cpp.so" --cachedirectory="<redacted>/Assets/../Library/il2cpp_android_armeabi-v7a/il2cpp_cache" --additional-include-directories="/Applications/2020.1.11f1/PlaybackEngines/AndroidPlayer/Tools/bdwgc/include" --additional-include-directories="/Applications/2020.1.11f1/PlaybackEngines/AndroidPlayer/Tools/libil2cpp/include" --baselib-directory="/Applications/2020.1.11f1/PlaybackEngines/AndroidPlayer/Variations/il2cpp/Release/StaticLibs/armeabi-v7a" --avoid-dynamic-library-copy --tool-chain-path="/Applications/2020.1.11f1/PlaybackEngines/AndroidPlayer/NDK" --profiler-report --map-file-parser="/Applications/2020.1.11f1/Unity.app/Contents/Tools/MapFileParser/MapFileParser" --directory="<redacted>/Temp/StagingArea/assets/bin/Data/Managed" --generatedcppdir="<redacted>/Temp/StagingArea/Il2Cpp/il2cppOutput"
stdout:
Running il2cpp.exe in workstation GC mode.
Building libil2cpp.so with …
Run Code Online (Sandbox Code Playgroud) 总是卡在IL2CPP超过10分钟。为什么以及如何加快这一过程?我尝试过找到的示例,例如导出到同一文件夹。
这个问题专门针对 Unity3d IL2CPP 和 iOS。
使用反射调用泛型方法
class SourceValue<T> { public T value; }
class TargetValue<T> { public T value; }
static TargetValue<T> GenericMethod<T> (SourceValue<T> source) {
return new TargetValue<T> { value = source.value };
}
void Main () {
Type genericType = typeof(SourceValue<float>);
Type typeArg = genericType.GenericTypeArguments[0];
MethodInfo mi = GetType ().GetMethod ("GenericMethod", Flags | BindingFlags.Static);
MethodInfo gmi = mi.MakeGenericMethod (typeArg);
object src = new SourceValue<float> { value = 0.5f };
object trg = gmi.Invoke (this, new object[] { src …
Run Code Online (Sandbox Code Playgroud) IL2CPP.exe是一个 Unity 实用程序,用于将 C# IL 代码转换为 C++。我的问题是:这个可执行文件是否可以在Unity 游戏开发环境之外用作通用工具,用于将任何.NET 应用程序(不仅仅是游戏)转换为高性能本机可执行文件?
虽然我确实懂一些C++,但如果能够用我熟悉且流利的语言 (C#)编写各种程序,那就太好了……无论是音频/视频/音乐制作 DAW 还是操作系统级安全/取证工具或机器学习平台或任何其他资源密集型......并且知道它们将像直接用 C++ 编写的应用程序一样高效运行。
我需要将2017.2至2017.3的项目表格更新为新的Vuforia版本(因为新的模型目标).播放器仍然可以正常工作.但是,如果我想为Hololens建立一个UWP应用程序.我收到错误,脚本后端不正确(使用IL2CPP).
Vuforia currently does not support the IL2CPP scripting backend for Windows Store Apps. Please select ".NET" as the scripting backend in the "Other Settings" section of the Player Settings
UnityEngine.Debug:LogError(Object)
BuildObserver:OnPreprocessBuild(BuildTarget, String)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Run Code Online (Sandbox Code Playgroud)
所以我在"设置"中更改为.NET.但现在错误是,IL2CPP构建了修补程序.
UnityException: Build path contains project built with IL2CPP scripting backend, while current project is using .NET scripting backend.
PostProcessWinRT.CheckSafeProjectOverwrite () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:303)
PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWinRT.cs:127)
UnityEditor.WSA.BuildPostprocessor.DoPostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:117)
UnityEditor.WSA.BuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:124)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Run Code Online (Sandbox Code Playgroud)
那我现在该怎么办?我能改变一下吗?
这些是我原来的设置: